| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(HOST_OS_WINDOWS) | 6 #if defined(HOST_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "bin/platform.h" | 8 #include "bin/platform.h" |
| 9 | 9 |
| 10 #include <crtdbg.h> | 10 #include <crtdbg.h> |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 SetConsoleOutputCP(CP_UTF8); | 83 SetConsoleOutputCP(CP_UTF8); |
| 84 SetConsoleCP(CP_UTF8); | 84 SetConsoleCP(CP_UTF8); |
| 85 | 85 |
| 86 // Try to set the bits for ANSI support, but swallow any failures. | 86 // Try to set the bits for ANSI support, but swallow any failures. |
| 87 HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); | 87 HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); |
| 88 DWORD out_mode; | 88 DWORD out_mode; |
| 89 if ((out != INVALID_HANDLE_VALUE) && GetConsoleMode(out, &out_mode)) { | 89 if ((out != INVALID_HANDLE_VALUE) && GetConsoleMode(out, &out_mode)) { |
| 90 const DWORD request = out_mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING; | 90 const DWORD request = out_mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING; |
| 91 SetConsoleMode(out, request); | 91 SetConsoleMode(out, request); |
| 92 } | 92 } |
| 93 HANDLE in = GetStdHandle(STD_INPUT_HANDLE); | 93 // TODO(28984): Due to issue #29104, we cannot set |
| 94 DWORD in_mode; | 94 // ENABLE_VIRTUAL_TERMINAL_INPUT here, as it causes ENABLE_PROCESSED_INPUT |
| 95 if ((in != INVALID_HANDLE_VALUE) && GetConsoleMode(in, &in_mode)) { | 95 // to be ignored. |
| 96 const DWORD request = in_mode | ENABLE_VIRTUAL_TERMINAL_INPUT; | |
| 97 SetConsoleMode(in, request); | |
| 98 } | |
| 99 } | 96 } |
| 100 | 97 |
| 101 static void RestoreConsole() { | 98 static void RestoreConsole() { |
| 102 MutexLocker ml(platform_win_mutex_); | 99 MutexLocker ml(platform_win_mutex_); |
| 103 RestoreConsoleLocked(); | 100 RestoreConsoleLocked(); |
| 104 } | 101 } |
| 105 | 102 |
| 106 private: | 103 private: |
| 107 static Mutex* platform_win_mutex_; | 104 static Mutex* platform_win_mutex_; |
| 108 static int saved_output_cp_; | 105 static int saved_output_cp_; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 PlatformWin::RestoreConsole(); | 271 PlatformWin::RestoreConsole(); |
| 275 // On Windows we use ExitProcess so that threads can't clobber the exit_code. | 272 // On Windows we use ExitProcess so that threads can't clobber the exit_code. |
| 276 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 | 273 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 |
| 277 ::ExitProcess(exit_code); | 274 ::ExitProcess(exit_code); |
| 278 } | 275 } |
| 279 | 276 |
| 280 } // namespace bin | 277 } // namespace bin |
| 281 } // namespace dart | 278 } // namespace dart |
| 282 | 279 |
| 283 #endif // defined(HOST_OS_WINDOWS) | 280 #endif // defined(HOST_OS_WINDOWS) |
| OLD | NEW |