From b242f27f49d7d9f4cfde87023925c6dbc982a2d8 Mon Sep 17 00:00:00 2001 From: Fedor Korotkov Date: Wed, 8 Feb 2023 15:15:34 -0500 Subject: [PATCH] Ignore GC errors (#405) * Ignore GC errors Such errors are not critical * Print GC error to stderr --- Sources/tart/Root.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/tart/Root.swift b/Sources/tart/Root.swift index 6e4febc..b435c0a 100644 --- a/Sources/tart/Root.swift +++ b/Sources/tart/Root.swift @@ -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()