Get Output and ExitStatus from Command

Is it possible to get both the output and the exit status for a command:

// only gives me stdout and stderr (captures it so I don't see its output while running)
let output = Command::new("git").args(["fetch", "-a"]).output()?;

// only gives me exit status (does not capture output so I see it while running)
let status = Command::new("git").args(["fetch", "-a"]).status()?;

Check out the return type of Output. Specifically the status member.

1 Like

....well guess my eyes didn't work when I was looking at the docs....

Thanks!