From 8fbd8f790dfc2a53cc810d51ca720e452f2d73bd Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 12 Aug 2021 21:53:29 +0300 Subject: [PATCH] os: cleanup for -Wimpure-v --- vlib/os/os.v | 12 ------------ vlib/os/os_c.v | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) 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) + } +}