From 555dbfc9fa1ec9f1050086b892fe9d5da049f7a0 Mon Sep 17 00:00:00 2001 From: Dmitry Kovba Date: Fri, 13 Jun 2025 19:48:59 -0700 Subject: [PATCH] Adds a warning when running a debug build (#201) This PR adds a warning that the performance may be degraded when running a debug build. Debug build: ``` % bin/container run -it --rm alpine:latest date Warning! Running debug build. Performance may be degraded. Fri Jun 13 18:10:35 PDT 2025 ``` Release build: ``` % bin/container run -it --rm alpine:latest date Fri Jun 13 18:10:35 PDT 2025 ``` --- Sources/CLI/Application.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sources/CLI/Application.swift b/Sources/CLI/Application.swift index 3d029bcf..3631de5a 100644 --- a/Sources/CLI/Application.swift +++ b/Sources/CLI/Application.swift @@ -150,6 +150,13 @@ struct Application: AsyncParsableCommand { public static func main() async throws { restoreCursorAtExit() + #if DEBUG + let warning = "Running debug build. Performance may be degraded." + let formattedWarning = "\u{001B}[33mWarning!\u{001B}[0m \(warning)\n" + let warningData = Data(formattedWarning.utf8) + FileHandle.standardError.write(warningData) + #endif + let fullArgs = CommandLine.arguments let args = Array(fullArgs.dropFirst())