From 678019b0371c44027e636b1f6f4e032c9f9cd333 Mon Sep 17 00:00:00 2001 From: Leonard Mosescu Date: Thu, 2 Dec 2021 16:39:35 -0800 Subject: [PATCH] Fix the cmake's output for vcpkg_get_dep_info() (#290) * Fix the cmake's output for vcpkg_get_dep_info() Set CLICOLOR=0 to force cmake to output "plain" text (without ANSI escape codes) * Adding a reference link Should explain the logic behind CLICOLOR and CLICOLOR_FORCE * Expand the comment * clang-format Co-authored-by: Billy Robert O'Neal III --- src/vcpkg.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/vcpkg.cpp b/src/vcpkg.cpp index 29a5b5da16..775ddcfc23 100644 --- a/src/vcpkg.cpp +++ b/src/vcpkg.cpp @@ -186,7 +186,16 @@ int main(const int argc, const char* const* const argv) } #endif set_environment_variable("VCPKG_COMMAND", get_exe_path_of_current_process().generic_u8string()); + + // Prevent child processes (ex. cmake) from producing "colorized" + // output (which may include ANSI escape codes), since it would + // complicate parsing the output. + // + // See http://bixense.com/clicolors for the semantics associated with + // the CLICOLOR and CLICOLOR_FORCE env variables + // set_environment_variable("CLICOLOR_FORCE", {}); + set_environment_variable("CLICOLOR", "0"); Checks::register_global_shutdown_handler([]() { const auto elapsed_us_inner = GlobalState::timer.microseconds();