| Index: runtime/bin/platform_win.cc
|
| diff --git a/runtime/bin/platform_win.cc b/runtime/bin/platform_win.cc
|
| index 71a274346d439320e45cbe43a029e26a2cf21091..f181ea005002850c29eb709634dcb0febe62f082 100644
|
| --- a/runtime/bin/platform_win.cc
|
| +++ b/runtime/bin/platform_win.cc
|
| @@ -65,12 +65,15 @@ class PlatformWin {
|
| saved_output_cp_ = GetConsoleOutputCP();
|
| SetConsoleOutputCP(CP_UTF8);
|
|
|
| + ansi_supported_ = true;
|
| HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
|
| if ((out != INVALID_HANDLE_VALUE) &&
|
| GetConsoleMode(out, &saved_console_out_mode_)) {
|
| const DWORD request =
|
| saved_console_out_mode_ | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
| - SetConsoleMode(out, request);
|
| + ansi_supported_ = ansi_supported_ && SetConsoleMode(out, request);
|
| + } else {
|
| + ansi_supported_ = false;
|
| }
|
|
|
| HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
|
| @@ -78,7 +81,9 @@ class PlatformWin {
|
| GetConsoleMode(in, &saved_console_in_mode_)) {
|
| const DWORD request =
|
| saved_console_in_mode_ | ENABLE_VIRTUAL_TERMINAL_INPUT;
|
| - SetConsoleMode(in, request);
|
| + ansi_supported_ = ansi_supported_ && SetConsoleMode(in, request);
|
| + } else {
|
| + ansi_supported_ = false;
|
| }
|
| }
|
|
|
| @@ -100,11 +105,14 @@ class PlatformWin {
|
| }
|
| }
|
|
|
| + static bool ansi_supported() { return ansi_supported_; }
|
| +
|
| private:
|
| static Mutex* platform_win_mutex_;
|
| static int saved_output_cp_;
|
| static DWORD saved_console_out_mode_;
|
| static DWORD saved_console_in_mode_;
|
| + static bool ansi_supported_;
|
|
|
| static void InvalidParameterHandler(const wchar_t* expression,
|
| const wchar_t* function,
|
| @@ -123,6 +131,7 @@ int PlatformWin::saved_output_cp_ = -1;
|
| DWORD PlatformWin::saved_console_out_mode_ = 0;
|
| DWORD PlatformWin::saved_console_in_mode_ = 0;
|
| Mutex* PlatformWin::platform_win_mutex_ = NULL;
|
| +bool PlatformWin::ansi_supported_ = false;
|
|
|
| bool Platform::Initialize() {
|
| PlatformWin::InitOnce();
|
| @@ -219,6 +228,11 @@ const char* Platform::ResolveExecutablePath() {
|
| }
|
|
|
|
|
| +bool Platform::AnsiSupported() {
|
| + return PlatformWin::ansi_supported();
|
| +}
|
| +
|
| +
|
| void Platform::Exit(int exit_code) {
|
| // TODO(zra): Remove once VM shuts down cleanly.
|
| ::dart::private_flag_windows_run_tls_destructors = false;
|
|
|