mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-06-05 14:15:01 -06:00
Windows: Don't re-attach stdio when piping output (#1812)
This commit is contained in:
parent
3b5c6f5246
commit
cd5838fc7f
32
src/main.cpp
32
src/main.cpp
@ -167,18 +167,28 @@ void UnitTests()
|
|||||||
bool isConsoleConnected = false;
|
bool isConsoleConnected = false;
|
||||||
void requireConsole()
|
void requireConsole()
|
||||||
{
|
{
|
||||||
#if BOOST_OS_WINDOWS
|
#if BOOST_OS_WINDOWS
|
||||||
if (isConsoleConnected)
|
if (isConsoleConnected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (AttachConsole(ATTACH_PARENT_PROCESS) != FALSE)
|
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
{
|
DWORD dwFileType = GetFileType(hOut);
|
||||||
freopen("CONIN$", "r", stdin);
|
|
||||||
freopen("CONOUT$", "w", stdout);
|
if (dwFileType == FILE_TYPE_UNKNOWN || dwFileType == FILE_TYPE_CHAR)
|
||||||
freopen("CONOUT$", "w", stderr);
|
{
|
||||||
isConsoleConnected = true;
|
if (AttachConsole(ATTACH_PARENT_PROCESS) != FALSE)
|
||||||
}
|
{
|
||||||
#endif
|
freopen("CONOUT$", "w", stdout);
|
||||||
|
freopen("CONOUT$", "w", stderr);
|
||||||
|
freopen("CONIN$", "r", stdin);
|
||||||
|
isConsoleConnected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isConsoleConnected = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandlePostUpdate()
|
void HandlePostUpdate()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user