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