Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/libs/dutil/WixToolset.DUtil/conutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@ extern "C" HRESULT DAPI ConsoleInitialize()
vfConsoleOut = TRUE;
}

if (!::SetConsoleCP(CP_UTF8) || !::SetConsoleOutputCP(CP_UTF8))
// Console codepage only applies to interactive sessions. SetConsoleCP may
// fail in console-less environments and the error path closes stdin/stdout.
if (vfStdOutInteractive)
{
ConExitWithLastError(hr, "failed to set console codepage to UTF-8");
if (!::SetConsoleCP(CP_UTF8) || !::SetConsoleOutputCP(CP_UTF8))
{
ConExitWithLastError(hr, "failed to set console codepage to UTF-8");
}
}

LExit:
Expand Down
Loading