os: cleanup for -Wimpure-v

pull/11166/head
Delyan Angelov 2021-08-12 21:53:29 +03:00
parent 47884dfd1f
commit 8fbd8f790d
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 12 additions and 12 deletions

View File

@ -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 {

View File

@ -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)
}
}