1
2
3
4
5
6
7
8
9
10
11
extern crate termion;

use std::fs;

fn main() {
    if termion::is_tty(&fs::File::create("/dev/stdout").unwrap()) {
        println!("This is a TTY!");
    } else {
        println!("This is not a TTY :(");
    }
}