added terminal check
This commit is contained in:
parent
808591fb9b
commit
f77f768416
2 changed files with 8 additions and 0 deletions
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
Loading…
Reference in a new issue