From 72664d87d2fb0782ca49a5f2118c64d0cf58e3f7 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Sun, 15 Oct 2023 18:56:55 +0200 Subject: Add the possibility to redirect the output to a file --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 1859606..1a93aef 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,9 @@ use nix::unistd::Pid; struct Args { /// Command to execute from ptrace command: String, + /// Write the output to a file instead of the standard output + #[arg(short = 'f', long = "file")] + file_to_print: Option, } /// Create a fork of the program and execute the process in the child. Parent gets the pid @@ -23,7 +26,7 @@ fn main() -> anyhow::Result<()> { Err(err) => panic!("fork() failed: {err}"), }; - trace(pid)?; + trace(pid, args.file_to_print)?; Ok(()) } -- cgit v1.2.3-18-g5258