mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Windows: Skip cmd for release builds (#5416)
This commit is contained in:
parent
94358a709b
commit
676951d90d
6 changed files with 42 additions and 7 deletions
|
@ -929,4 +929,18 @@ bool secure_rand_fill_buf(void *buf, size_t len)
|
|||
|
||||
#endif
|
||||
|
||||
void attachOrCreateConsole(void)
|
||||
{
|
||||
#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;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
} //namespace porting
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue