mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-07-30 20:58:45 +00:00
chore: format
This commit is contained in:
parent
30c4994f6b
commit
ac99741517
1 changed files with 8 additions and 3 deletions
|
@ -1,5 +1,8 @@
|
||||||
use nix::{
|
use nix::{
|
||||||
sys::signal::{kill, Signal::{SIGTERM, SIGKILL}},
|
sys::signal::{
|
||||||
|
kill,
|
||||||
|
Signal::{SIGKILL, SIGTERM},
|
||||||
|
},
|
||||||
unistd::Pid,
|
unistd::Pid,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -16,7 +19,8 @@ use std::{
|
||||||
mpsc::{sync_channel, Receiver, SyncSender},
|
mpsc::{sync_channel, Receiver, SyncSender},
|
||||||
Arc, Mutex,
|
Arc, Mutex,
|
||||||
},
|
},
|
||||||
thread::{self, JoinHandle, sleep}, time::Duration,
|
thread::{self, sleep, JoinHandle},
|
||||||
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct CmdRunner {
|
pub struct CmdRunner {
|
||||||
|
@ -142,7 +146,8 @@ impl CmdRunner {
|
||||||
kill(child_pid, SIGTERM).expect("Could not send sigterm to process");
|
kill(child_pid, SIGTERM).expect("Could not send sigterm to process");
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
sleep(Duration::from_secs(2));
|
sleep(Duration::from_secs(2));
|
||||||
if kill(child_pid, None).is_ok() { // process is still alive
|
if kill(child_pid, None).is_ok() {
|
||||||
|
// process is still alive
|
||||||
kill(child_pid, SIGKILL).expect("Failed to kill process");
|
kill(child_pid, SIGKILL).expect("Failed to kill process");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue