mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Merge pull request #684 from roderickvd/fix-onevent-panic
Log error instead of panicking when child fails to start
This commit is contained in:
commit
8973d29837
1 changed files with 13 additions and 8 deletions
21
src/main.rs
21
src/main.rs
|
@ -768,15 +768,20 @@ async fn main() {
|
||||||
Some(event) => {
|
Some(event) => {
|
||||||
if let Some(program) = &setup.player_event_program {
|
if let Some(program) = &setup.player_event_program {
|
||||||
if let Some(child) = run_program_on_events(event, program) {
|
if let Some(child) = run_program_on_events(event, program) {
|
||||||
let mut child = child.expect("program failed to start");
|
if child.is_ok() {
|
||||||
|
|
||||||
tokio::spawn(async move {
|
let mut child = child.unwrap();
|
||||||
match child.wait().await {
|
|
||||||
Ok(status) if !status.success() => error!("child exited with status {:?}", status.code()),
|
tokio::spawn(async move {
|
||||||
Err(e) => error!("failed to wait on child process: {}", e),
|
match child.wait().await {
|
||||||
_ => {}
|
Ok(status) if !status.success() => error!("child exited with status {:?}", status.code()),
|
||||||
}
|
Err(e) => error!("failed to wait on child process: {}", e),
|
||||||
});
|
_ => {}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
error!("program failed to start");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue