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::{
env::current_dir,
io::{ stdout, IsTerminal },
path::Path,
process::{ Command, Stdio }
process::{ exit, Command, Stdio }
};
use pico_args::Arguments;
@ -110,6 +111,11 @@ fn main() {
let command = properties.get("command").unwrap().as_str().unwrap().to_string();
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
let mut parts = command.split(" ");
let mut child = Command::new(parts.next().unwrap());