We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b4da272 commit 2c4e609Copy full SHA for 2c4e609
1 file changed
src/libs/dutil/WixToolset.DUtil/conutil.cpp
@@ -67,9 +67,14 @@ extern "C" HRESULT DAPI ConsoleInitialize()
67
vfConsoleOut = TRUE;
68
}
69
70
- if (!::SetConsoleCP(CP_UTF8) || !::SetConsoleOutputCP(CP_UTF8))
+ // 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)
73
{
- 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
+ }
78
79
80
LExit:
0 commit comments