diff options
Diffstat (limited to 'init/src/services/units.rs')
| -rw-r--r-- | init/src/services/units.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/init/src/services/units.rs b/init/src/services/units.rs index ec0098b..a4e65ca 100644 --- a/init/src/services/units.rs +++ b/init/src/services/units.rs @@ -11,7 +11,7 @@ // of service and showing its output? idk 4 now, look into how its supposed to be use crate::{RUNLEVEL_STATE, log_success, log_warning}; -use libc::{kill, SIGKILL, SIGTERM}; +use libc::{SIGKILL, SIGTERM, kill}; use serde::Deserialize; use std::{ fs::{read_dir, read_to_string}, @@ -191,7 +191,10 @@ pub fn services_mainloop() -> Result<(), Box<dyn std::error::Error + Send>> { match child.try_wait() { Ok(Some(status)) => { let pid = child.id(); - log_warning(&format!("Service exited: {} (PID: {}, status: {:?})", exec, pid, status)); + log_warning(&format!( + "Service exited: {} (PID: {}, status: {:?})", + exec, pid, status + )); // Remove from global PID list if let Ok(mut guard) = SERVICE_PIDS.lock() { @@ -220,7 +223,9 @@ pub fn services_mainloop() -> Result<(), Box<dyn std::error::Error + Send>> { *restart_count += 1; // Update PID in global list if let Ok(mut guard) = SERVICE_PIDS.lock() { - if let Some(pos) = guard.iter().position(|(p, e)| *p == pid && e == exec) { + if let Some(pos) = + guard.iter().position(|(p, e)| *p == pid && e == exec) + { guard[pos] = (new_pid, exec.clone()); } } @@ -349,7 +354,7 @@ pub fn stop_all_services() -> Result<(), Box<dyn std::error::Error>> { if unsafe { kill(*pid as i32, 0) } == 0 { all_dead = false; break; - ` } + } } if all_dead { break; |
