diff options
| author | namilsk <namilsk@namilsk.tech> | 2026-03-23 23:36:10 +0300 |
|---|---|---|
| committer | namilsk <namilsk@namilsk.tech> | 2026-03-23 23:36:10 +0300 |
| commit | 91a7400ad2c3b1edf63116ed9d05619b9bccf9b8 (patch) | |
| tree | 1f9b858b2a35e0f50d162b0f7f8a0c55afc6d18a /init/src/services | |
| parent | b78dd23f021c7f4ec3604e6bb8b44765dab7d68e (diff) | |
Diffstat (limited to 'init/src/services')
| -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; |
