diff --git a/vlib/os/os.v b/vlib/os/os.v index 088aeb797d..47ea85b0c3 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -640,18 +640,6 @@ pub fn execute_or_exit(cmd string) Result { 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 { mut matches := []string{} for pattern in patterns { diff --git a/vlib/os/os_c.v b/vlib/os/os_c.v index 8275a9f34a..2cc2bdb14f 100644 --- a/vlib/os/os_c.v +++ b/vlib/os/os_c.v @@ -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) } } + +// 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) + } +}