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