1
0
Fork 0
mirror of https://github.com/lise-henry/crowbook synced 2024-05-28 01:36:17 +02:00

run_command does not need to set the path again

This commit is contained in:
stefan0xC 2022-02-23 16:03:15 +01:00
parent 8eaad5b3cf
commit 4d8afae890

View File

@ -133,23 +133,20 @@ This is forbidden because we are supposed \
in_file: &str,
out: &mut dyn Write,
) -> Result<String> {
let res_output = command
.current_dir(&self.path)
.output()
.map_err(|e| {
debug!(
"{}",
lformat!(
"output for command {name}:\n{error}",
name = command_name,
error = e
)
);
Error::zipper(lformat!(
"failed to run command '{name}'",
name = command_name
))
});
let res_output = command.output().map_err(|e| {
debug!(
"{}",
lformat!(
"output for command {name}:\n{error}",
name = command_name,
error = e
)
);
Error::zipper(lformat!(
"failed to run command '{name}'",
name = command_name
))
});
let output = res_output?;
if output.status.success() {
let mut file = File::open(self.path.join(in_file)).map_err(|_| {
@ -192,6 +189,7 @@ This is forbidden because we are supposed \
/// zip all files in zipper's tmp dir to a given file name and write to odt file
pub fn generate_odt(&mut self, command_name: &str, odt_file: &mut dyn Write) -> Result<String> {
let mut command = Command::new(command_name);
command.current_dir(&self.path);
command.arg("-r");
command.arg("result.odt");
command.arg(".");