From cf49fd10b63c7511eb785d268bb041dba688b9be Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Thu, 18 May 2023 19:11:22 +0400 Subject: [PATCH] Print errors to stderr (#504) --- Sources/tart/Commands/Run.swift | 2 +- Sources/tart/Root.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/tart/Commands/Run.swift b/Sources/tart/Commands/Run.swift index ce8264ba..dc0833b1 100644 --- a/Sources/tart/Commands/Run.swift +++ b/Sources/tart/Commands/Run.swift @@ -209,7 +209,7 @@ struct Run: AsyncParsableCommand { SentrySDK.capture(error: error) SentrySDK.flush(timeout: 2.seconds.timeInterval) - print(error) + fputs("\(error)\n", stderr) Foundation.exit(1) } diff --git a/Sources/tart/Root.swift b/Sources/tart/Root.swift index 7722a064..01be2b52 100644 --- a/Sources/tart/Root.swift +++ b/Sources/tart/Root.swift @@ -94,7 +94,7 @@ struct Root: AsyncParsableCommand { // Handle a non-ArgumentParser's exception that requires a specific exit code to be set if let errorWithExitCode = error as? HasExitCode { - print(error) + fputs("\(error)\n", stderr) Foundation.exit(errorWithExitCode.exitCode) }