diff options
| author | ruki <[email protected]> | 2017-09-25 22:43:38 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-09-25 10:21:51 +0800 |
| commit | b2e0a63e0840247d2662f0b7b0ac97b95cebb382 (patch) | |
| tree | 8d9c8e5261464bb96103e6d0592b81132fa3754d /core/src | |
| parent | 1cb688b8a4377c521a7dfd23df4de239cc19c817 (diff) | |
enable colors output for windows cmd
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/xmake/machine.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/src/xmake/machine.c b/core/src/xmake/machine.c index ad1c4d366..75fc9548d 100644 --- a/core/src/xmake/machine.c +++ b/core/src/xmake/machine.c @@ -549,6 +549,21 @@ xm_machine_ref_t xm_machine_init() lua_newtable(impl->lua); lua_setglobal(impl->lua, "xmake"); +#ifdef TB_CONFIG_OS_WINDOWS + // enable terminal colors output for windows cmd + HANDLE output = GetStdHandle(STD_OUTPUT_HANDLE); + if (output != INVALID_HANDLE_VALUE) + { + DWORD mode; + if (GetConsoleMode(output, &mode)) + { + // attempt to enable 0x4: ENABLE_VIRTUAL_TERMINAL_PROCESSING + if (SetConsoleMode(output, mode | 0x4)) + tb_environment_set("COLORTERM", "color256"); + } + } +#endif + // ok ok = tb_true; |
