|
|
@ -26,7 +26,7 @@ pub struct App {
|
|
|
|
impl App {
|
|
|
|
impl App {
|
|
|
|
/// start the application and wait for it to exit
|
|
|
|
/// start the application and wait for it to exit
|
|
|
|
pub fn wait_start(&self) -> Result<()> {
|
|
|
|
pub fn wait_start(&self) -> Result<()> {
|
|
|
|
info!("starting application {}", &self.name);
|
|
|
|
info!("[{}] starting", &self.name);
|
|
|
|
|
|
|
|
|
|
|
|
let mut command = Command::new(&self.command);
|
|
|
|
let mut command = Command::new(&self.command);
|
|
|
|
let args = self.args.as_ref();
|
|
|
|
let args = self.args.as_ref();
|
|
|
@ -55,13 +55,10 @@ impl App {
|
|
|
|
/// see if the app should be restarted
|
|
|
|
/// see if the app should be restarted
|
|
|
|
pub fn check_restart(&self, status: ExitStatus) -> bool {
|
|
|
|
pub fn check_restart(&self, status: ExitStatus) -> bool {
|
|
|
|
if status.success() {
|
|
|
|
if status.success() {
|
|
|
|
info!("application exited: {}", &self.name);
|
|
|
|
|
|
|
|
self.restart_on_success.unwrap_or(false)
|
|
|
|
self.restart_on_success.unwrap_or(false)
|
|
|
|
} else if let Some(code) = status.code() {
|
|
|
|
} else if let Some(code) = status.code() {
|
|
|
|
info!("application failed: {} ({})", &self.name, code);
|
|
|
|
|
|
|
|
self.restart_on_failure.unwrap_or(false)
|
|
|
|
self.restart_on_failure.unwrap_or(false)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
info!("application terminated: {}", &self.name);
|
|
|
|
|
|
|
|
self.restart_on_terminate.unwrap_or(false)
|
|
|
|
self.restart_on_terminate.unwrap_or(false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|