From f7d1df03e0901e37843425d01d818718716230ba Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Sat, 5 Mar 2022 17:09:36 +0100 Subject: [PATCH] Start all command processes without waiting to finish another one --- README.adoc | 2 +- src/main.rs | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/README.adoc b/README.adoc index 6a59041..25e5405 100644 --- a/README.adoc +++ b/README.adoc @@ -35,7 +35,7 @@ You can optionally specify `check_type`: === Execute commands -_This feature is experimental and starts further commands only after previous commands have been finished._ +_This feature is still experimental._ You can also specify a command to be executed when a mouse click occurs on a checked host. Use `click_cmd` to specifiy the command to be executed, e.g. diff --git a/src/main.rs b/src/main.rs index 866b533..5bf2f57 100644 --- a/src/main.rs +++ b/src/main.rs @@ -132,17 +132,11 @@ async fn get_click_cmd(name: String) -> Option { } async fn run_click_cmd(cmd: String) { - let _r = match std::process::Command::new("sh") + if let Ok(mut child) = std::process::Command::new("sh") .stdin(std::process::Stdio::piped()) - .stderr(std::process::Stdio::piped()) - .spawn() - { - Ok(mut child) => { + .spawn() { use std::io::Write; - let _r = child.stdin.as_mut().unwrap().write_all(cmd.as_bytes()); - child.wait() - } - Err(e) => Err(e), + let _ = child.stdin.as_mut().unwrap().write_all(cmd.as_bytes()); }; }