diff options
author | Mahmoud Al-Qudsi <mqudsi@neosmart.net> | 2018-12-10 03:53:23 (GMT) |
---|---|---|
committer | Mahmoud Al-Qudsi <mqudsi@neosmart.net> | 2018-12-10 03:53:23 (GMT) |
commit | 342b939bd3f32c43cf49825aa4ec7d8a8ba4cffd (patch) | |
tree | 93580c67834386e77b33b27578f2ac15a15a3bd3 /src/line_printer.cc | |
parent | 811b864045f1c440fe21a56802e7e20981578d6f (diff) | |
download | Ninja-342b939bd3f32c43cf49825aa4ec7d8a8ba4cffd.zip Ninja-342b939bd3f32c43cf49825aa4ec7d8a8ba4cffd.tar.gz Ninja-342b939bd3f32c43cf49825aa4ec7d8a8ba4cffd.tar.bz2 |
Unset suports_color_ if SetConsoleMode fails on WIN32
Diffstat (limited to 'src/line_printer.cc')
-rw-r--r-- | src/line_printer.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/line_printer.cc b/src/line_printer.cc index 953982a..1f8eee1 100644 --- a/src/line_printer.cc +++ b/src/line_printer.cc @@ -54,7 +54,9 @@ LinePrinter::LinePrinter() : have_blank_line_(true), console_locked_(false) { if (supports_color_) { DWORD mode; if (GetConsoleMode(console_, &mode)) { - SetConsoleMode(console_, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING); + if (!SetConsoleMode(console_, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)) { + supports_color_ = false; + } } } #endif |