added terminal check

This commit is contained in:
Valerie Wolfe 2023-08-15 21:30:10 -04:00
parent 808591fb9b
commit f77f768416
2 changed files with 8 additions and 0 deletions

View file

@ -30,3 +30,8 @@ pub fn missing_target() {
exit(4); exit(4);
} }
pub fn not_terminal() {
println!("remux: not running from a terminal");
exit(5);
}

View file

@ -1,3 +1,4 @@
use std::io::{ stdout, IsTerminal };
use pico_args::Arguments; use pico_args::Arguments;
@ -13,6 +14,8 @@ fn main() {
return; return;
} }
if !stdout().is_terminal() { error::not_terminal(); }
let subcommand = args.subcommand().unwrap(); let subcommand = args.subcommand().unwrap();
match subcommand.as_deref() { match subcommand.as_deref() {