move shutdown stuff out of startup()

master
rasul 5 years ago
parent ced0ce6286
commit 2b31859e23

@ -14,6 +14,7 @@ mod proc;
mod result;
use apps::Apps;
use proc::Proc;
use result::Result;
fn main() {
@ -26,17 +27,25 @@ fn main() {
error!("FATAL: {:?}", e);
std::process::exit(1);
}
match startup() {
Ok(p) => {
info!("shutting down");
for mut proc in p {
proc.stop();
}
}
Err(e) => {
error!("FATAL: {:?}", e);
std::process::exit(1);
}
};
}
fn startup() -> Result<()> {
fn startup() -> Result<Vec<Proc>> {
let apps = Apps::load("sup.toml")?;
let (procs, holds) = apps.start();
let procs = apps.run(procs, holds)?;
info!("shutting down");
for mut proc in procs {
proc.stop();
}
Ok(())
Ok(procs)
}

Loading…
Cancel
Save