Skip to content

Commit 151c55d

Browse files
committed
services that fail while waiting for the READY=1 need to get their pid/pgid cleared too. Moved from stop into posstop
1 parent 513bf10 commit 151c55d

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/services/services.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,7 @@ impl Service {
255255
name: &str,
256256
run_info: &RuntimeInfo,
257257
) -> Result<(), RunCmdError> {
258-
let stop_res = self.run_stop_cmd(conf, id, name, run_info.clone());
259-
if conf.srcv_type != ServiceType::OneShot {
260-
// already happened when the oneshot process exited in the exit handler
261-
self.kill_all_remaining_processes(name);
262-
}
263-
self.pid = None;
264-
self.process_group = None;
265-
stop_res
258+
self.run_stop_cmd(conf, id, name, run_info.clone())
266259
}
267260
pub fn kill(
268261
&mut self,
@@ -523,7 +516,16 @@ impl Service {
523516
}
524517
let timeout = self.get_start_timeout(conf);
525518
let cmds = conf.stoppost.clone();
526-
self.run_all_cmds(&cmds, id, name, timeout, run_info.clone())
519+
let res = self.run_all_cmds(&cmds, id, name, timeout, run_info.clone());
520+
521+
if conf.srcv_type != ServiceType::OneShot {
522+
// already happened when the oneshot process exited in the exit handler
523+
self.kill_all_remaining_processes(name);
524+
}
525+
self.pid = None;
526+
self.process_group = None;
527+
528+
res
527529
}
528530

529531
pub fn log_stdout_lines(&mut self, name: &str, status: &UnitStatus) -> std::io::Result<()> {

0 commit comments

Comments
 (0)