Chromium Code Reviews| Index: runtime/bin/platform_win.cc |
| diff --git a/runtime/bin/platform_win.cc b/runtime/bin/platform_win.cc |
| index 601d4d7b7635f0031e63b320c2fa3a7b5bdf7526..bbbd8b7841ed8eb61e19d8d9d8f196d0d4b052e7 100644 |
| --- a/runtime/bin/platform_win.cc |
| +++ b/runtime/bin/platform_win.cc |
| @@ -27,7 +27,12 @@ char* Platform::resolved_executable_name_ = NULL; |
| int Platform::script_index_ = 1; |
| char** Platform::argv_ = NULL; |
| +static int old_output_cp = -1; |
| + |
| bool Platform::Initialize() { |
| + ASSERT(old_output_cp == -1); |
| + old_output_cp = GetConsoleOutputCP(); |
| + SetConsoleOutputCP(CP_UTF8); |
| SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); |
| return true; |
| } |
| @@ -124,6 +129,11 @@ const char* Platform::ResolveExecutablePath() { |
| void Platform::Exit(int exit_code) { |
| // TODO(zra): Remove once VM shuts down cleanly. |
| ::dart::private_flag_windows_run_tls_destructors = false; |
| + // Restore the console's output code page |
| + if (old_output_cp != -1) { |
| + SetConsoleOutputCP(old_output_cp); |
|
Florian Schneider
2017/02/21 20:34:50
Can there be multiple threads calling Platform::Ex
zra
2017/02/21 21:26:46
Yes. This can happen if multiple isolates call Pla
|
| + old_output_cp = -1; |
| + } |
| // On Windows we use ExitProcess so that threads can't clobber the exit_code. |
| // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 |
| ::ExitProcess(exit_code); |