This commit is contained in:
Adrian Heine 2017-05-19 18:15:16 +02:00
parent dac3db10c8
commit eadd5f5b07
24 changed files with 108 additions and 193 deletions

View file

@ -159,7 +159,7 @@ impl<'a, C, R> Symbol for NodeJsSystemdUserService<'a, C, R> where C: Deref<Targ
fn execute(&self) -> Result<(), Box<Error>> {
try!(self.file.execute());
try!(self.systemctl_wait_for_dbus(&["--user", "enable", self.service_name]));
try!(self.systemctl_wait_for_dbus(&["--user", "start", self.service_name]));
try!(self.systemctl_wait_for_dbus(&["--user", "restart", self.service_name]));
if !(try!(self.check_if_service())) {
return Err(Box::new(NodeJsSystemdUserServiceError::GenericError as NodeJsSystemdUserServiceError<io::Error>));

View file

@ -24,8 +24,7 @@ impl<'a> Symbol for ReloadService<'a> {
}
fn execute(&self) -> Result<(), Box<Error>> {
try!(self.command_runner.run_with_args("systemctl", &["reload-or-restart", self.service]));
Ok(())
self.command_runner.run_successfully("systemctl", &["reload-or-restart", self.service])
}
}

View file

@ -1,9 +1,7 @@
use std::borrow::{ Borrow, Cow };
use std::error::Error;
use std::fmt;
use std::io::Error as IoError;
use std::path::PathBuf;
use std::str::from_utf8;
use command_runner::CommandRunner;
use symbols::Symbol;
@ -58,13 +56,7 @@ impl<'a> Symbol for SystemdUserSession<'a> {
}
fn execute(&self) -> Result<(), Box<Error>> {
match self.command_runner.run_with_args("loginctl", &["enable-linger", self.user_name.borrow()]) {
Ok(output) => { println!("{:?} {:?}", from_utf8(&output.stdout).unwrap(), from_utf8(&output.stderr).unwrap() ); match output.status.code() {
Some(0) => Ok(()),
_ => Err(Box::new(SystemdUserSessionError::GenericError as SystemdUserSessionError<IoError>))
} },
Err(e) => Err(Box::new(SystemdUserSessionError::ExecError(e)))
}
self.command_runner.run_successfully("loginctl", &["enable-linger", self.user_name.borrow()])
}
}