mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
windows: make redirected console detection available to other modules
This commit is contained in:
parent
60d4f47f7a
commit
0963328aed
@ -141,7 +141,9 @@ byteptr g_str_buf;
|
||||
int load_so(byteptr);
|
||||
void reload_so();
|
||||
void init_consts();
|
||||
|
||||
#ifdef _WIN32
|
||||
BOOL isConsole;
|
||||
#endif
|
||||
'
|
||||
|
||||
js_headers = '
|
||||
|
@ -402,7 +402,7 @@ fn (v mut V) generate_main() {
|
||||
cgen.genln('void init_consts() {
|
||||
#ifdef _WIN32
|
||||
DWORD consoleMode;
|
||||
BOOL isConsole = GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &consoleMode);
|
||||
isConsole = GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &consoleMode);
|
||||
int mode = isConsole ? _O_U16TEXT : _O_U8TEXT;
|
||||
_setmode(_fileno(stdin), mode);
|
||||
_setmode(_fileno(stdout), _O_U8TEXT);
|
||||
|
Loading…
Reference in New Issue
Block a user