added non-terminal behavior

This commit is contained in:
Valerie Wolfe 2023-08-14 11:58:36 -04:00
parent 6526bedce3
commit 2812a556e1

View file

@ -1,7 +1,8 @@
use std::{ use std::{
env::current_dir, env::current_dir,
io::{ stdout, IsTerminal },
path::Path, path::Path,
process::{ Command, Stdio } process::{ exit, Command, Stdio }
}; };
use pico_args::Arguments; use pico_args::Arguments;
@ -110,6 +111,11 @@ fn main() {
let command = properties.get("command").unwrap().as_str().unwrap().to_string(); let command = properties.get("command").unwrap().as_str().unwrap().to_string();
let shell = properties.get("shell").unwrap_or(&Value::Boolean(false)).as_bool().unwrap(); let shell = properties.get("shell").unwrap_or(&Value::Boolean(false)).as_bool().unwrap();
if !stdout().is_terminal() {
println!("{command} {i_target}");
exit(0);
}
// build child // build child
let mut parts = command.split(" "); let mut parts = command.split(" ");
let mut child = Command::new(parts.next().unwrap()); let mut child = Command::new(parts.next().unwrap());