|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
extern crate chrono;
|
|
|
|
|
extern crate colored;
|
|
|
|
|
extern crate dirs;
|
|
|
|
|
#[macro_use]
|
|
|
|
|
extern crate log;
|
|
|
|
|
extern crate serde;
|
|
|
|
@ -13,6 +14,10 @@ mod logger;
|
|
|
|
|
mod proc;
|
|
|
|
|
mod result;
|
|
|
|
|
|
|
|
|
|
use std::path::PathBuf;
|
|
|
|
|
|
|
|
|
|
use dirs::config_dir;
|
|
|
|
|
|
|
|
|
|
use apps::Apps;
|
|
|
|
|
use proc::Proc;
|
|
|
|
|
use result::Result;
|
|
|
|
@ -23,7 +28,15 @@ fn main() {
|
|
|
|
|
std::process::exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
match startup() {
|
|
|
|
|
let apps_file: PathBuf = match config_dir() {
|
|
|
|
|
Some(mut d) => {
|
|
|
|
|
d.push("sup.toml");
|
|
|
|
|
d
|
|
|
|
|
}
|
|
|
|
|
None => PathBuf::from("sup.toml"),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
match startup(apps_file) {
|
|
|
|
|
Ok(p) => {
|
|
|
|
|
info!("shutting down");
|
|
|
|
|
for mut proc in p {
|
|
|
|
@ -37,10 +50,9 @@ fn main() {
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn startup() -> Result<Vec<Proc>> {
|
|
|
|
|
let apps = Apps::load("sup.toml")?;
|
|
|
|
|
fn startup(apps_file: PathBuf) -> Result<Vec<Proc>> {
|
|
|
|
|
let apps = Apps::load(apps_file)?;
|
|
|
|
|
let (procs, holds) = apps.start();
|
|
|
|
|
let procs = apps.run(procs, holds)?;
|
|
|
|
|
|
|
|
|
|
Ok(procs)
|
|
|
|
|
}
|
|
|
|
|