Add timeout log to run_command

This commit is contained in:
elkowar 2023-03-26 13:10:35 +02:00
parent 88cd3a29dc
commit e76206817d
No known key found for this signature in database
GPG key ID: E321AD71B1D1F27F

View file

@ -20,7 +20,7 @@ where
std::thread::Builder::new() std::thread::Builder::new()
.name("command-execution-thread".to_string()) .name("command-execution-thread".to_string())
.spawn(move || { .spawn(move || {
log::debug!("Running command from widget: {}", cmd); log::debug!("Running command from widget [timeout: {}ms]: {}", timeout.as_millis(), cmd);
let child = Command::new("/bin/sh").arg("-c").arg(&cmd).spawn(); let child = Command::new("/bin/sh").arg("-c").arg(&cmd).spawn();
match child { match child {
Ok(mut child) => match child.wait_timeout(timeout) { Ok(mut child) => match child.wait_timeout(timeout) {