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) => {
|
||||
if let Some(program) = &setup.player_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 {
|
||||
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),
|
||||
_ => {}
|
||||
}
|
||||
});
|
||||
let mut child = child.unwrap();
|
||||
|
||||
tokio::spawn(async move {
|
||||
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