|
|
|
@ -146,15 +146,11 @@ fn main() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[allow(clippy::cognitive_complexity)]
|
|
|
|
|
fn run() -> SupResult<()> {
|
|
|
|
|
let config = Config::load("sup.toml")?;
|
|
|
|
|
info!("loaded config: sup.toml");
|
|
|
|
|
|
|
|
|
|
fn start_apps(apps: Vec<App>) -> (Vec<Proc>, Option<i8>) {
|
|
|
|
|
let mut procs: Vec<Proc> = Vec::new();
|
|
|
|
|
let mut holds: Option<i8> = None;
|
|
|
|
|
|
|
|
|
|
for app in config.apps() {
|
|
|
|
|
for app in apps {
|
|
|
|
|
if app.wait.unwrap_or(false) {
|
|
|
|
|
if let Err(e) = app.wait_start() {
|
|
|
|
|
error!("app failed to start: {}: {:?}", &app.name, e);
|
|
|
|
@ -168,11 +164,20 @@ fn run() -> SupResult<()> {
|
|
|
|
|
}
|
|
|
|
|
procs.push(proc);
|
|
|
|
|
}
|
|
|
|
|
Err(e) => error!("application failed to start: {}: {:?}", name, e),
|
|
|
|
|
Err(e) => error!("app failed to start: {}: {:?}", name, e),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(procs, holds)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn run() -> SupResult<()> {
|
|
|
|
|
let config = Config::load("sup.toml")?;
|
|
|
|
|
info!("loaded config: sup.toml");
|
|
|
|
|
|
|
|
|
|
let (mut procs, mut holds) = start_apps(config.apps());
|
|
|
|
|
|
|
|
|
|
if holds.unwrap_or(0) < 1 {
|
|
|
|
|
error!("no holds configured");
|
|
|
|
|
return Ok(());
|
|
|
|
|