|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
use std::boxed::Box;
|
|
|
|
|
use std::sync::mpsc::TryRecvError;
|
|
|
|
|
|
|
|
|
|
use colored::Colorize;
|
|
|
|
|
|
|
|
|
|
use mio::{Events, Poll, PollOpt, Ready, Token};
|
|
|
|
|
use mio_child_process::{ProcessEvent, StdioChannel};
|
|
|
|
|
|
|
|
|
@ -42,7 +44,7 @@ fn restart_app(proc: Proc) -> Result<Proc> {
|
|
|
|
|
match Proc::start(app) {
|
|
|
|
|
Ok(p) => Ok(p),
|
|
|
|
|
Err(e) => {
|
|
|
|
|
error!("[{}] error restarting: {:?}", name, e);
|
|
|
|
|
error!("[{}] error restarting: {:?}", name.yellow(), e);
|
|
|
|
|
Err(e)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -96,19 +98,19 @@ fn run_loop(procs: Vec<Proc>, holds: Option<i8>, poll: Poll, signals: Signals) -
|
|
|
|
|
}
|
|
|
|
|
// error starting or closing child process
|
|
|
|
|
Ok(ProcessEvent::CommandError(e)) => {
|
|
|
|
|
error!("[{}] command error: {:?}", &proc.app.name, e)
|
|
|
|
|
error!("[{}] command error: {:?}", &proc.app.name.yellow(), e)
|
|
|
|
|
}
|
|
|
|
|
// error reading stdout or stderr
|
|
|
|
|
Ok(ProcessEvent::IoError(channel, e)) => {
|
|
|
|
|
error!("[{}] io error on {:?}: {:?}", &proc.app.name, channel, e)
|
|
|
|
|
error!("[{}] io error on {:?}: {:?}", &proc.app.name.yellow(), channel, e)
|
|
|
|
|
}
|
|
|
|
|
// error doing utf8 translation
|
|
|
|
|
Ok(ProcessEvent::Utf8Error(channel, e)) => {
|
|
|
|
|
error!("[{}] utf8 error on {:?}: {:?}", &proc.app.name, channel, e)
|
|
|
|
|
error!("[{}] utf8 error on {:?}: {:?}", &proc.app.name.yellow(), channel, e)
|
|
|
|
|
}
|
|
|
|
|
// process exited
|
|
|
|
|
Ok(ProcessEvent::Exit(status)) => {
|
|
|
|
|
info!("[{}] exited with status {}", &proc.app.name, status);
|
|
|
|
|
info!("[{}] exited with status {}", &proc.app.name.yellow(), status);
|
|
|
|
|
let hold = proc.app.hold.unwrap_or(false);
|
|
|
|
|
if proc.app.check_restart(status) {
|
|
|
|
|
if let Ok(p) = restart_app(proc) {
|
|
|
|
|