Log error instead of panicking when child fails to start

This commit is contained in:
Roderick van Domburg 2021-03-31 22:13:36 +02:00
parent 56f1fb6dae
commit 0149725d77

View file

@ -639,8 +639,9 @@ impl Future for Main {
progress = true; progress = true;
if let Some(ref program) = self.player_event_program { if let Some(ref program) = self.player_event_program {
if let Some(child) = run_program_on_events(event, program) { if let Some(child) = run_program_on_events(event, program) {
if child.is_ok() {
let child = child let child = child
.expect("program failed to start") .unwrap()
.map(|status| { .map(|status| {
if !status.success() { if !status.success() {
error!("child exited with status {:?}", status.code()); error!("child exited with status {:?}", status.code());
@ -649,6 +650,9 @@ impl Future for Main {
.map_err(|e| error!("failed to wait on child process: {}", e)); .map_err(|e| error!("failed to wait on child process: {}", e));
self.handle.spawn(child); self.handle.spawn(child);
} else {
error!("{:?} failed to start", program);
}
} }
} }
} }