diff --git a/Projects/BuildTool/Program.cs b/Projects/BuildTool/Program.cs index dd2b16479..915839bbf 100644 --- a/Projects/BuildTool/Program.cs +++ b/Projects/BuildTool/Program.cs @@ -4,6 +4,7 @@ using BuildTool.Interactive; using BuildTool.Platform; using BuildTool.Prerequisites; using BuildTool.Publishing; +using Spectre.Console; Console.OutputEncoding = Encoding.UTF8; @@ -38,25 +39,18 @@ var rid = $"{options.Os}-{options.Arch}"; if (options.CheckPrereqsOnly) { - var allPassed = true; - - foreach (var result in NativeLibraryChecker.Check(detectedPlatform)) + // Same renderer the guided menu uses, so the two cannot drift. Spectre drops ANSI styling by + // itself when stdout is not a terminal, which is the case this flag exists for, but it also + // falls back to an 80 column width and folds anything longer. The install hints we print are + // shell commands — the CentOS one is 95 characters — and a fold puts a newline in the middle of + // a command that someone is meant to copy. Widen the profile so they stay on one line. + if (Console.IsOutputRedirected) { - if (!result.IsWarning) - { - Console.WriteLine($"{result.Name,-16} {(result.Passed ? "OK" : "MISSING"),-8} {result.Details}"); - allPassed &= result.Passed; - continue; - } - - Console.WriteLine(result.Details); - if (result.InstallCommand is not null) - { - Console.WriteLine($" {result.InstallCommand}"); - } + AnsiConsole.Profile.Width = 200; } - return allPassed ? 0 : 1; + // Exit code is the machine-readable half: 0 when everything resolves, 1 when anything is missing. + return PrerequisiteChecker.CheckNativeLibraries(detectedPlatform, interactive: false) ? 0 : 1; } // Run prerequisite checks unless skipped