master
rascul 2 years ago
parent 26ec5d25e8
commit fea7e96970

@ -53,31 +53,44 @@ impl Apps {
self.apps.clone()
}
/// start all the apps
pub fn start(&self) -> (Vec<Proc>, Option<i8>, Poll) {
// the managed processes
let mut procs: Vec<Proc> = Vec::new();
// number of things to hold on
let mut holds: Option<i8> = None;
// this should be changed to not unwrap
let poll = Poll::new().unwrap();
for app in self.apps() {
// app needs to be waited on before starting the next one
if app.wait.unwrap_or(false) {
if let Err(e) = app.wait_start() {
error!("[{}] failed to start: {:?}", &app.name.yellow(), e);
}
} else {
}
// app can go in the background
else {
let name = app.name.clone();
match Proc::start(app) {
Ok(proc) => {
// see if we need to hold on this app
if proc.app.hold.unwrap_or(false) {
holds = Some(holds.unwrap_or(0) + 1);
}
// register the app to poll the status
poll.register(
&proc.process,
proc.token,
Ready::readable(),
PollOpt::edge(),
)
.unwrap();
.unwrap(); // gotta get rid of this unwrap
procs.push(proc);
}
Err(e) => {

Loading…
Cancel
Save