1 /* 2 This internal module contains the terminal detection implementation. 3 4 If the `auto-color` feature is enabled then we detect whether we're attached to a particular TTY. 5 Otherwise, assume we're not attached to anything. This effectively prevents styles from being 6 printed. 7 */ 8 9 #[cfg(feature = "auto-color")] 10 mod imp { 11 use is_terminal::IsTerminal; 12 is_stdout() -> bool13 pub(in crate::fmt) fn is_stdout() -> bool { 14 std::io::stdout().is_terminal() 15 } 16 is_stderr() -> bool17 pub(in crate::fmt) fn is_stderr() -> bool { 18 std::io::stderr().is_terminal() 19 } 20 } 21 22 #[cfg(not(feature = "auto-color"))] 23 mod imp { is_stdout() -> bool24 pub(in crate::fmt) fn is_stdout() -> bool { 25 false 26 } 27 is_stderr() -> bool28 pub(in crate::fmt) fn is_stderr() -> bool { 29 false 30 } 31 } 32 33 pub(in crate::fmt) use self::imp::*; 34