Don't set 'stdout' to _O_BINARY mode on Windows, because it can have some weird effect when printing text to the terminal. Also, we currently don't output any "binary" data to 'stdout' anyway.
This commit is contained in:
parent
21cab67912
commit
2e74accf36
@ -71,15 +71,18 @@ static void clear_cmdline_args(char *const acmdln, wchar_t *const wcmdln)
|
|||||||
if (len > 5U) wcscpy(wcmdln, L"slunk");
|
if (len > 5U) wcscpy(wcmdln, L"slunk");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void set_translation_mode(FILE* const stream, const int utf8_mode)
|
||||||
|
{
|
||||||
|
_setmode(_fileno(stream), utf8_mode ? _O_U8TEXT : _O_BINARY);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void init_terminal(void)
|
void init_terminal(void)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
||||||
_setmode(_fileno(stdout), _O_BINARY);
|
set_translation_mode(stderr, 1);
|
||||||
_setmode(_fileno(stdin), _O_BINARY);
|
set_translation_mode(stdin, 0);
|
||||||
_setmode(_fileno(stderr), _O_U8TEXT);
|
|
||||||
clear_cmdline_args(_acmdln, _wcmdln);
|
clear_cmdline_args(_acmdln, _wcmdln);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user