Browse Source

Streamline command runner a bit

master
Adrian Heine 1 day ago
parent
commit
0a6b6efd7a
  1. 4
      src/command_runner.rs
  2. 2
      src/symbols/cron.rs

4
src/command_runner.rs

@ -29,7 +29,7 @@ pub fn is_success(res: Result<Output, impl Error + 'static>) -> Result<Output, B
check_success(res?)
}
pub fn get_output(output: Output) -> Result<Vec<u8>, Box<dyn Error>> {
pub fn get_stdout(output: Output) -> Result<Vec<u8>, Box<dyn Error>> {
Ok(check_success(output)?.stdout)
}
@ -55,7 +55,7 @@ pub trait CommandRunner {
args: &'a [&'a OsStr],
) -> Result<Vec<u8>, Box<dyn Error>> {
let output = self.run_with_args(program, args).await?;
get_output(output)
get_stdout(output)
}
async fn run_successfully<'a>(
&self,

2
src/symbols/cron.rs

@ -37,7 +37,7 @@ impl<C: AsRef<[u8]>, U: AsRef<str>, R: CommandRunner> Symbol for Cron<'_, C, U,
.run(
"crontab",
args!["-u", self.user.as_ref(), "-",],
self.content.as_ref(),
self.content.as_ref(), // input
)
.await,
)?;

Loading…
Cancel
Save