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