diff --git a/src/launcher/main.rs b/src/launcher/main.rs index a066dfeb84ac1d500b0510ab50c10ff07aa41766..468a5296d8a58b6264acadf2ef6a87f192ee991e 100644 --- a/src/launcher/main.rs +++ b/src/launcher/main.rs @@ -1,5 +1,6 @@ #![deny(warnings)] #![feature(const_fn)] +#![feature(process_try_wait)] extern crate event; extern crate orbclient; @@ -232,6 +233,26 @@ fn bar_main() { if time_file.read(&mut time)? >= mem::size_of::<TimeSpec>() { let mut bar = bar_time.borrow_mut(); + let mut i = 0; + while i < bar.children.len() { + let remove = match bar.children[i].try_wait() { + Ok(None) => false, + Ok(Some(status)) => { + println!("launcher: {} exited with {}", bar.children[i].id(), status); + true + }, + Err(err) => { + println!("launcher: failed to wait for {}: {}", bar.children[i].id(), err); + true + } + }; + if remove { + bar.children.remove(i); + } else { + i += 1; + } + } + bar.update_time(); bar.draw();