1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

make V work on Windows 7

This commit is contained in:
vitalyster
2019-11-06 23:04:40 +03:00
committed by Alexander Medvednikov
parent e266c8a750
commit 8dbeab9a7b
5 changed files with 21 additions and 9 deletions

View File

@@ -3,11 +3,19 @@ module term
import os
pub fn can_show_color_on_stdout() bool {
return is_atty(1) && os.getenv('TERM') != 'dumb'
return supports_escape_sequences(1)
}
pub fn can_show_color_on_stderr() bool {
return is_atty(2) && os.getenv('TERM') != 'dumb'
return supports_escape_sequences(2)
}
fn supports_escape_sequences(fd int) bool {
$if windows {
return (is_atty(fd) & 0x0004) > 0 && os.getenv('TERM') != 'dumb' // ENABLE_VIRTUAL_TERMINAL_PROCESSING
} $else {
return is_atty(fd) > 0 && os.getenv('TERM') != 'dumb'
}
}
//////////////////////////////////////////////