sl_console/sys/unix/
tty.rs

1
2
3
4
5
6
use std::os::unix::io::AsRawFd;

/// Is this stream a TTY?
pub fn is_tty<T: AsRawFd>(stream: &T) -> bool {
    unsafe { libc::isatty(stream.as_raw_fd()) == 1 }
}