-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add Debug derive to std::process::Output #30403
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Actually, I'm not sure the derived impl would be best here. Stdout and stderr are both |
What would be the alternative assume the stdout/stder will always be utf8 or ascii and convert the outputs to a utf8 string? |
|
Since stdout/err doesn't need to be text I prefer @sfackler's latter option, printing text if utf8 and binary if not. Truncated in each case I guess. |
If thats the consensus I can write up a debug implementation tomorrow (late here). I'll keep the pull request open till thats done I guess. |
Sounds good! |
What should I put as the stability annotation on the function? |
The stability checking logic doesn't check trait implementations, so it's automatically stable. |
I got a "src/libstd/process.rs:406:1: 429:2 error: This node does not have a stability attribute", on a build I ran myself |
@webmobster |
@@ -400,6 +401,33 @@ pub struct Output { | |||
pub stderr: Vec<u8>, | |||
} | |||
|
|||
//If either stderr or stdout are valid utf8 strings it prints the valid strings, otherwise it | |||
//prints the byte sequence instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stylistically there's typically a space after the //
, and can you also format this comment to a maximum width of 80 chars? (the surrounding style)
Looks good to me (including the stability annotation @petrochenkov mentioned) |
Done |
I didn't see any reason that debug couldn't be added to this object, since every field derives debug.
I didn't see any reason that debug couldn't be added to this object, since every field derives debug.