Skip to content
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

std_misc/process/pipe: remove unnecessary enclosing block #704

Merged
merged 1 commit into from
Mar 9, 2016
Merged

Conversation

ivan
Copy link
Contributor

@ivan ivan commented Jan 20, 2016

Fixes #702.

Thanks to mbrubeck and sfackler for helping me out with this.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (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.

//
// This is very important, otherwise `wc` wouldn't start processing the
// input we just sent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block (5 lines above this) should probably be removed because it is related to the braces you just removed. It makes little sense without them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it in (and rephrased it slightly) because it seemed important to mention that the implicit dropping causes ChildStdin to close. (If someone has a let mut stdin = process.stdin;, the program will hang forever.)

Is the phrasing incorrect?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. If it is important to emphasize that point, you should save it to a variable and include the braces which were just backed out to emphasize the dropping. IDK, I guess it might be nitpicky though. Not sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't object to putting the braces back and adding a let mut stdin = to emphasize the dropping, if that's the Rust way of doing things.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the wording is just odd. Can't think of anything better right now.

@steveklabnik
Copy link
Member

Any idea what w should do here?

@ivan
Copy link
Contributor Author

ivan commented Mar 8, 2016

To summarize, it could be

  1. left as-is with a slightly confusing unnecessary block

  2. changed as per my PR to remove the block, and rely on a non-obvious but commented implicit Drop

  3. left as-is except with an extra let stdin = local inside the block, to emphasize the Drop

But I really don't know what to do here because I don't know how this is written in real Rust programs.

@steveklabnik
Copy link
Member

I think I vote #1, after sleeping on it.

Thank you!

steveklabnik added a commit that referenced this pull request Mar 9, 2016
std_misc/process/pipe: remove unnecessary enclosing block
@steveklabnik steveklabnik merged commit 3ab7a6d into rust-lang:master Mar 9, 2016
@ivan
Copy link
Contributor Author

ivan commented Mar 9, 2016

I think you voted for number 2 since you merged it?

@steveklabnik
Copy link
Member

.... yes. I am very, very jetlagged, hehe. merging was what I wanted to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants