1 //! Helper module which provides a function to test
2 //! if stdout is a tty.
6 pub fn stdout_isatty() -> bool {
7 unsafe { libc::isatty(libc::STDOUT_FILENO) != 0 }
9 } else if #[cfg(windows)] {
10 pub fn stdout_isatty() -> bool {
13 type HANDLE = *mut u8;
14 type LPDWORD = *mut u32;
15 const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD;
17 fn GetStdHandle(which: DWORD) -> HANDLE;
18 fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: LPDWORD) -> BOOL;
21 let handle = GetStdHandle(STD_OUTPUT_HANDLE);
23 GetConsoleMode(handle, &mut out) != 0
27 // FIXME: Implement isatty on SGX
28 pub fn stdout_isatty() -> bool {