summaryrefslogtreecommitdiff
path: root/init/src/services
diff options
context:
space:
mode:
Diffstat (limited to 'init/src/services')
-rw-r--r--init/src/services/units.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/init/src/services/units.rs b/init/src/services/units.rs
index 01c4183..6e3223e 100644
--- a/init/src/services/units.rs
+++ b/init/src/services/units.rs
@@ -14,7 +14,7 @@ use crate::{RUNLEVEL_STATE, log_warning};
use serde::Deserialize;
use std::{
fs::{read_dir, read_to_string},
- process::Child,
+ process::{Child, ExitStatus},
time::Duration,
};
@@ -226,7 +226,7 @@ pub fn services_mainloop() -> Result<(), Box<dyn std::error::Error + Send>> {
for i in 0..pids.len() {
match pids[i].0.try_wait() {
Ok(Some(status)) => {
- if pids[i].2 == Restart::Always && pids[i].3 < 3 {
+ if pids[i].2 == Restart::Always && pids[i].3 < 3 && status.code() != Some(0) {
let new_child = std::process::Command::new(pids[i].1.clone())
.spawn()
.map_err(|e| Box::new(e) as Box<dyn std::error::Error + Send>)?;