The std::process::Command Issue

https://doc.rust-lang.org/std/process/struct.Command.html

How could get the whole command which exec in the OS.

if I didn't know what exec, how could I debug it?

Thanks.

Command implements the Debug trait, so you can format it with macros like format! or println! for debugging purposes:

let command_string = format!("{:?}", command);

By the way, questions like this should go to the Rust Users Forum. This forum is for developers of the Rust compiler and standard libraries/tools.

2 Likes

this is really nothing important in the log.

Err(Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." })
Ok(Child { stdin: None, stdout: None, stderr: None, .. })

How could I print what the detail command exec in the log.

You’ll need to log the command before you run it. If you have more questions, please head over to the users forum.

1 Like