|
@ -38,15 +38,18 @@ where |
|
|
let tab = self
|
|
|
let tab = self
|
|
|
.command_runner
|
|
|
.command_runner
|
|
|
.get_output("crontab", &["-l", "-u", &self.user])?;
|
|
|
.get_output("crontab", &["-l", "-u", &self.user])?;
|
|
|
return Ok(tab == self.content.bytes().collect::<Vec<u8>>());
|
|
|
|
|
|
|
|
|
Ok(tab == self.content.bytes().collect::<Vec<u8>>())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
fn execute(&self) -> Result<(), Box<dyn Error>> {
|
|
|
fn execute(&self) -> Result<(), Box<dyn Error>> {
|
|
|
self.command_runner.run_with_args_and_stdin(
|
|
|
|
|
|
|
|
|
let output = self.command_runner.run_with_args_and_stdin(
|
|
|
"crontab",
|
|
|
"crontab",
|
|
|
&["-u", &self.user, "-"],
|
|
|
&["-u", &self.user, "-"],
|
|
|
&self.content,
|
|
|
&self.content,
|
|
|
)?;
|
|
|
)?;
|
|
|
|
|
|
if !output.status.success() {
|
|
|
|
|
|
return Err(String::from_utf8(output.stderr)?.into());
|
|
|
|
|
|
}
|
|
|
Ok(())
|
|
|
Ok(())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|