-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More verbose impl fmt::Debug for process::Command #42200
Comments
We also currently have no way to extract most of this information without utilizing Debug, so out of tree implementations can't be implemented. |
Would/should this be the specific additions to the environment set by That is, this patch (in src/libstd/sys/unix/process/process_common.rs)— impl fmt::Debug for Command {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{:?}", self.program)?;
- for arg in &self.args {
- write!(f, " {:?}", arg)?;
- }
- Ok(())
+ f.debug_struct("Command")
+ .field("program", &self.program)
+ .field("args", &self.args)
+ .field("env", &self.env)
+ .field("argv", &self.argv)
+ .field("envp", &self.envp)
+ .field("cwd", &self.cwd)
+ .field("uid", &self.uid)
+ .field("gid", &self.gid)
+ .field("saw_nul", &self.saw_nul)
+ .field("stdin", &self.stdin)
+ .field("stdout", &self.stdout)
+ .field("stderr", &self.stderr)
+ .finish()
}
} results in program behavior like this (scroll right to see the very bulky output;
|
I'd be fine with the verbose output. The debug output is only meant for debug purposes and generating the full environment saves us from oh-that's-why-it's-not-working-this-stupid-thing moments |
Seems reasonable. I would be ready to consider a PR implementing this. |
Triage: no changes here. I've actually wanted this too, but don't have the bandwidth to work on it, personally. |
Mainly based on commit: zackmdavis@ccc019a from https://github.com/zackmdavis close rust-lang#42200
More verbose `Debug` implementation of `std::process:Command` Mainly based on commit: zackmdavis@ccc019a from https://github.com/zackmdavis close rust-lang#42200
More verbose `Debug` implementation of `std::process:Command` Mainly based on commit: zackmdavis/rust@ccc019a from https://github.com/zackmdavis close rust-lang/rust#42200
based on commit: zackmdavis/rust@ccc019a from https://github.com/zackmdavis close rust-lang/rust#42200 Add env variables and cwd to the shell-like debug output. Also use the alternate syntax to display a more verbose display, while not showing internal fields and hiding fields when they have their default value.
More verbose `Debug` implementation of `std::process:Command` Mainly based on commit: zackmdavis/rust@ccc019a from https://github.com/zackmdavis close rust-lang/rust#42200
impl fmt::Debug for process::Command
currently only outputs the program and it's arguments. It should also output the environment variables and the current path, as set by.env()
,.envs()
and.current_dir()
. This would help with figuring out what's going on :-)The text was updated successfully, but these errors were encountered: