Just spawn event handlers, don't wait for exit code.

This commit is contained in:
Simon Persson 2018-02-20 23:12:52 +01:00
parent 93af49aadf
commit 23d3c1593f

View file

@ -4,13 +4,12 @@ use librespot::playback::player::PlayerEvent;
fn run_program(program: &str, env_vars: HashMap<&str, String>) { fn run_program(program: &str, env_vars: HashMap<&str, String>) {
let mut v: Vec<&str> = program.split_whitespace().collect(); let mut v: Vec<&str> = program.split_whitespace().collect();
info!("Running {:?}", v); info!("Running {:?} with environment variables {:?}", v, env_vars);
let status = Command::new(&v.remove(0)) Command::new(&v.remove(0))
.args(&v) .args(&v)
.envs(env_vars.iter()) .envs(env_vars.iter())
.status() .spawn()
.expect("program failed to start"); .expect("program failed to start");
info!("Exit status: {}", status);
} }
pub fn run_program_on_events(event: PlayerEvent, onevent: &str) { pub fn run_program_on_events(event: PlayerEvent, onevent: &str) {