blob: 0694aa56c23ae3609236c815b73568bd3f847d92 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
mod trace;
use crate::trace::{exec, trace};
use clap::Parser;
use fork::{fork, Fork};
use nix::unistd::Pid;
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
struct Args {
command: String,
}
fn main() -> anyhow::Result<()> {
let args = Args::parse();
let pid = match fork() {
Ok(Fork::Child) => return exec(&args.command),
Ok(Fork::Parent(child)) => Pid::from_raw(child as i32),
Err(err) => panic!("fork() failed: {err}"),
};
trace(pid)?;
Ok(())
}
|