From 2812a556e12aa79e8598baad7d08e9403e0a60a9 Mon Sep 17 00:00:00 2001 From: Valerie Date: Mon, 14 Aug 2023 11:58:36 -0400 Subject: [PATCH] added non-terminal behavior --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index da8f92e..e9b713f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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());