From 43d3b72f480a630a4dc1d8b558a0f4e18ae244cd Mon Sep 17 00:00:00 2001 From: Adrian Heine Date: Tue, 24 Sep 2019 22:56:38 +0200 Subject: [PATCH] Improve Cron --- src/symbols/cron.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/symbols/cron.rs b/src/symbols/cron.rs index f27ab25..23ca311 100644 --- a/src/symbols/cron.rs +++ b/src/symbols/cron.rs @@ -38,15 +38,18 @@ where let tab = self .command_runner .get_output("crontab", &["-l", "-u", &self.user])?; - return Ok(tab == self.content.bytes().collect::>()); + Ok(tab == self.content.bytes().collect::>()) } fn execute(&self) -> Result<(), Box> { - self.command_runner.run_with_args_and_stdin( + let output = self.command_runner.run_with_args_and_stdin( "crontab", &["-u", &self.user, "-"], &self.content, )?; + if !output.status.success() { + return Err(String::from_utf8(output.stderr)?.into()); + } Ok(()) }