os: cleanup for -Wimpure-v
parent
47884dfd1f
commit
8fbd8f790d
12
vlib/os/os.v
12
vlib/os/os.v
|
@ -640,18 +640,6 @@ pub fn execute_or_exit(cmd string) Result {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
// is_atty returns 1 if the `fd` file descriptor is open and refers to a terminal
|
|
||||||
pub fn is_atty(fd int) int {
|
|
||||||
$if windows {
|
|
||||||
mut mode := u32(0)
|
|
||||||
osfh := voidptr(C._get_osfhandle(fd))
|
|
||||||
C.GetConsoleMode(osfh, voidptr(&mode))
|
|
||||||
return int(mode)
|
|
||||||
} $else {
|
|
||||||
return C.isatty(fd)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn glob(patterns ...string) ?[]string {
|
pub fn glob(patterns ...string) ?[]string {
|
||||||
mut matches := []string{}
|
mut matches := []string{}
|
||||||
for pattern in patterns {
|
for pattern in patterns {
|
||||||
|
|
|
@ -977,3 +977,15 @@ pub fn execve(cmdpath string, args []string, envs []string) ? {
|
||||||
return error_with_code(posix_get_error_msg(C.errno), C.errno)
|
return error_with_code(posix_get_error_msg(C.errno), C.errno)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// is_atty returns 1 if the `fd` file descriptor is open and refers to a terminal
|
||||||
|
pub fn is_atty(fd int) int {
|
||||||
|
$if windows {
|
||||||
|
mut mode := u32(0)
|
||||||
|
osfh := voidptr(C._get_osfhandle(fd))
|
||||||
|
C.GetConsoleMode(osfh, voidptr(&mode))
|
||||||
|
return int(mode)
|
||||||
|
} $else {
|
||||||
|
return C.isatty(fd)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue