|
|
|
@ -129,31 +129,62 @@ fn run_loop(procs: Vec<Proc>, holds: Option<i8>, poll: Poll, signals: Signals) -
|
|
|
|
|
if code == 0 {
|
|
|
|
|
info!("[{}] exited successfully", &proc.app.name.yellow());
|
|
|
|
|
|
|
|
|
|
if proc.app.restart_on_failure {
|
|
|
|
|
if proc.app.restart_on_success {
|
|
|
|
|
if let Ok(p) = restart_app(&proc) {
|
|
|
|
|
poll.register(&p.process, p.token, Ready::all(), PollOpt::edge())
|
|
|
|
|
poll.register(
|
|
|
|
|
&p.process,
|
|
|
|
|
p.token,
|
|
|
|
|
Ready::all(),
|
|
|
|
|
PollOpt::edge(),
|
|
|
|
|
)
|
|
|
|
|
.unwrap();
|
|
|
|
|
procs.push(p);
|
|
|
|
|
procs.push(p);
|
|
|
|
|
} else if hold {
|
|
|
|
|
holds = Some(holds.unwrap_or(0) - 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
info!("[{}] exited unsuccessfully with code {}", &proc.app.name.yellow(), code);
|
|
|
|
|
info!(
|
|
|
|
|
"[{}] exited unsuccessfully with code {}",
|
|
|
|
|
&proc.app.name.yellow(),
|
|
|
|
|
code
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if proc.app.restart_on_failure {
|
|
|
|
|
if let Ok(p) = restart_app(&proc) {
|
|
|
|
|
poll.register(
|
|
|
|
|
&p.process,
|
|
|
|
|
p.token,
|
|
|
|
|
Ready::all(),
|
|
|
|
|
PollOpt::edge(),
|
|
|
|
|
)
|
|
|
|
|
.unwrap();
|
|
|
|
|
procs.push(p);
|
|
|
|
|
} else if hold {
|
|
|
|
|
holds = Some(holds.unwrap_or(0) - 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
info!("[{}] was terminated", &proc.app.name.yellow());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if proc.app.check_restart(status) {
|
|
|
|
|
if let Ok(p) = restart_app(&proc) {
|
|
|
|
|
poll.register(&p.process, p.token, Ready::all(), PollOpt::edge())
|
|
|
|
|
if proc.app.restart_on_terminate {
|
|
|
|
|
if let Ok(p) = restart_app(&proc) {
|
|
|
|
|
poll.register(
|
|
|
|
|
&p.process,
|
|
|
|
|
p.token,
|
|
|
|
|
Ready::all(),
|
|
|
|
|
PollOpt::edge(),
|
|
|
|
|
)
|
|
|
|
|
.unwrap();
|
|
|
|
|
procs.push(p);
|
|
|
|
|
} else if hold {
|
|
|
|
|
holds = Some(holds.unwrap_or(0) - 1);
|
|
|
|
|
procs.push(p);
|
|
|
|
|
} else if hold {
|
|
|
|
|
holds = Some(holds.unwrap_or(0) - 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if hold {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if hold {
|
|
|
|
|
holds = Some(holds.unwrap_or(0) - 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|