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

Travis: run tests for Windows (#1403)

This commit is contained in:
vitalyster
2019-07-31 20:01:52 +03:00
committed by Alexander Medvednikov
parent 7918a790b4
commit 37a0e6ebef
4 changed files with 6 additions and 31 deletions

View File

@@ -6,28 +6,6 @@ module term
import os
// Calling this functions enables color terminal output on windows
// Maybe implement a way to auto run an init function when a module
// is imported on a certain os. for example to run this?
pub fn enable_term_color_win() {
mode_wanted := os.ENABLE_PROCESSED_OUTPUT | os.ENABLE_VIRTUAL_TERMINAL_PROCESSING
mut mode_current := 0
h_output := C.GetStdHandle(os.STD_OUTPUT_HANDLE)
if h_output == os.INVALID_HANDLE_VALUE {
panic('term.enable_term_color_win(): error getting output handle.')
}
if !C.GetConsoleMode(h_output, &mode_current) {
panic('term.enable_term_color_win(): error getting console mode.')
}
if mode_wanted == mode_current {
return
}
if !C.SetConsoleMode(h_output, mode_wanted) {
panic('term.enable_term_color_win(): error setting console mode.')
}
}
pub fn format(msg, open, close string) string {
enable_term_color_win()
return _format(msg, open, close)
}