mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 08:03:45 +01:00
Fix logic in porting::attachOrCreateConsole()
No functional change but now the comment is actually correct.
This commit is contained in:
parent
e04f618979
commit
6550bc252f
@ -737,12 +737,14 @@ void osSpecificInit()
|
||||
void attachOrCreateConsole()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
static bool consoleAllocated = false;
|
||||
const bool redirected = (_fileno(stdout) == -2 || _fileno(stdout) == -1); // If output is redirected to e.g a file
|
||||
if (!consoleAllocated && redirected && (AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())) {
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
consoleAllocated = true;
|
||||
static bool once = false;
|
||||
const bool redirected = _fileno(stdout) >= 0; // If output is redirected to e.g a file
|
||||
if (!once && !redirected) {
|
||||
if (AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole()) {
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
}
|
||||
once = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user