From 03844980bfc9fb3cd20e07bd122e67cd6283adfd Mon Sep 17 00:00:00 2001 From: Yonas Yanfa Date: Wed, 4 Jan 2023 14:22:14 -0500 Subject: [PATCH] Append to output file instead of overwritting. --- src/exec.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/exec.rs b/src/exec.rs index 82d35e9..0e7b961 100644 --- a/src/exec.rs +++ b/src/exec.rs @@ -281,13 +281,19 @@ fn start_cmd(op: &CmdOp) -> Result { // connect stdout, stderr and stdin if requested if let Some(ref out_path) = op.out_file { - let out_file = fs::File::create(out_path)?; + let out_file = fs::OpenOptions::new() + .create(true) + .write(true) + .append(true) + .open(out_path)?; cmd.stdout(out_file); } + if let Some(ref err_path) = op.err_file { let err_file = fs::File::create(err_path)?; cmd.stderr(err_file); } + if let Some(ref in_path) = op.in_file { let in_file = fs::File::create(in_path)?; cmd.stdin(in_file);