Ignore GC errors (#405)

* Ignore GC errors

Such errors are not critical

* Print GC error to stderr
This commit is contained in:
Fedor Korotkov 2023-02-08 15:15:34 -05:00 committed by GitHub
parent b566d07bc4
commit b242f27f49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import ArgumentParser
import Darwin
import Foundation
import Sentry
@ -76,7 +77,11 @@ struct Root: AsyncParsableCommand {
var command = try parseAsRoot()
// Run garbage-collection before each command (shouldn't take too long)
try Config().gc()
do {
try Config().gc()
} catch {
fputs("Failed to perform garbage collection!\n\(error)\n", stderr)
}
if var asyncCommand = command as? AsyncParsableCommand {
try await asyncCommand.run()