diff options
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/conutil.cpp')
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/conutil.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/conutil.cpp b/src/libs/dutil/WixToolset.DUtil/conutil.cpp index 059af0e0..858128cd 100644 --- a/src/libs/dutil/WixToolset.DUtil/conutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/conutil.cpp | |||
| @@ -67,9 +67,14 @@ extern "C" HRESULT DAPI ConsoleInitialize() | |||
| 67 | vfConsoleOut = TRUE; | 67 | vfConsoleOut = TRUE; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | if (!::SetConsoleCP(CP_UTF8) || !::SetConsoleOutputCP(CP_UTF8)) | 70 | // Console codepage only applies to interactive sessions. SetConsoleCP may |
| 71 | // fail in console-less environments and the error path closes stdin/stdout. | ||
| 72 | if (vfStdOutInteractive) | ||
| 71 | { | 73 | { |
| 72 | ConExitWithLastError(hr, "failed to set console codepage to UTF-8"); | 74 | if (!::SetConsoleCP(CP_UTF8) || !::SetConsoleOutputCP(CP_UTF8)) |
| 75 | { | ||
| 76 | ConExitWithLastError(hr, "failed to set console codepage to UTF-8"); | ||
| 77 | } | ||
| 73 | } | 78 | } |
| 74 | 79 | ||
| 75 | LExit: | 80 | LExit: |
