From a7b91483263e85e49f2acf8936f8990dfe157886 Mon Sep 17 00:00:00 2001 From: John Flanagan Date: Thu, 5 Jun 2025 13:25:01 -0500 Subject: [PATCH] Support ANSI commands when using xcodebuild --- Sources/ConsoleKitTerminal/Terminal/Console.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/ConsoleKitTerminal/Terminal/Console.swift b/Sources/ConsoleKitTerminal/Terminal/Console.swift index 89e5e182..1b0d2af6 100644 --- a/Sources/ConsoleKitTerminal/Terminal/Console.swift +++ b/Sources/ConsoleKitTerminal/Terminal/Console.swift @@ -88,12 +88,12 @@ public protocol Console: AnyObject, Sendable { extension Console { public var supportsANSICommands: Bool { - #if Xcode - // Xcode output does not support ANSI commands - return false - #else // If STDOUT is not an interactive terminal then omit ANSI commands - return isatty(STDOUT_FILENO) > 0 - #endif + guard isatty(STDOUT_FILENO) > 0 else { + return false + } + + // "dumb" terminals, such as Xcode's, do not support ANSI commands. + return ProcessInfo.processInfo.environment["TERM"] != "dumb" } }