1/* 2This internal module contains the terminal detection implementation. 3 4If the `atty` crate is available then we use it to detect whether we're 5attached to a particular TTY. If the `atty` crate is not available we 6assume we're not attached to anything. This effectively prevents styles 7from being printed. 8*/ 9 10#[cfg(feature = "atty")] 11mod imp { 12 pub(in crate::fmt) fn is_stdout() -> bool { 13 atty::is(atty::Stream::Stdout) 14 } 15 16 pub(in crate::fmt) fn is_stderr() -> bool { 17 atty::is(atty::Stream::Stderr) 18 } 19} 20 21#[cfg(not(feature = "atty"))] 22mod imp { 23 pub(in crate::fmt) fn is_stdout() -> bool { 24 false 25 } 26 27 pub(in crate::fmt) fn is_stderr() -> bool { 28 false 29 } 30} 31 32pub(in crate::fmt) use self::imp::*; 33