mirror of
https://github.com/pcvolkmer/checkbar.git
synced 2025-04-19 19:16:50 +00:00
Start all command processes without waiting to finish another one
This commit is contained in:
parent
fbc5237a8e
commit
f7d1df03e0
@ -35,7 +35,7 @@ You can optionally specify `check_type`:
|
|||||||
|
|
||||||
=== Execute commands
|
=== 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.
|
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.
|
Use `click_cmd` to specifiy the command to be executed, e.g.
|
||||||
|
12
src/main.rs
12
src/main.rs
@ -132,17 +132,11 @@ async fn get_click_cmd(name: String) -> Option<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn run_click_cmd(cmd: String) {
|
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())
|
.stdin(std::process::Stdio::piped())
|
||||||
.stderr(std::process::Stdio::piped())
|
.spawn() {
|
||||||
.spawn()
|
|
||||||
{
|
|
||||||
Ok(mut child) => {
|
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
let _r = child.stdin.as_mut().unwrap().write_all(cmd.as_bytes());
|
let _ = child.stdin.as_mut().unwrap().write_all(cmd.as_bytes());
|
||||||
child.wait()
|
|
||||||
}
|
|
||||||
Err(e) => Err(e),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user