Skip to content

impl io::{Read,Write} for PtyMaster #1210

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

Merged
merged 1 commit into from
Apr 24, 2020
Merged

Conversation

cuviper
Copy link
Contributor

@cuviper cuviper commented Apr 9, 2020

PtyMaster acts like an owned file descriptor, even closing on Drop.
Implementing io::Read and io::Write lets it be used directly in
standard I/O operations.

@asomers
Copy link
Member

asomers commented Apr 12, 2020

This change makes sense to me. However, please split that test method up. It's too big, and tests too much. I'm also going to request a review from @Susurrus because he's more knowledgeable about pseudoterminals than I am.

@cuviper
Copy link
Contributor Author

cuviper commented Apr 13, 2020

However, please split that test method up. It's too big, and tests too much.

I kept it together because the existing test code is all necessary setup to get a usable pair for my read/write tests. Even if I extracted that setup into some common function, the only difference from the current test would be the two asserts for fd > 0.

@asomers
Copy link
Member

asomers commented Apr 19, 2020

However, please split that test method up. It's too big, and tests too much.

I kept it together because the existing test code is all necessary setup to get a usable pair for my read/write tests. Even if I extracted that setup into some common function, the only difference from the current test would be the two asserts for fd > 0.

My objection is that you're testing io::Read and io::Write in the same test, even though they're logically separate functionality. Those should be in separate test methods, sharing a common setup function.

@cuviper
Copy link
Contributor Author

cuviper commented Apr 20, 2020

Those should be in separate test methods, sharing a common setup function.

OK, I've now split that up.

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

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

Looks good! Now, could you please squash your commits?

@cuviper
Copy link
Contributor Author

cuviper commented Apr 21, 2020

I've rebased and squashed to one commit.

I think CI isn't triggering with the current GitHub outages, but I'll check back in a while and re-push if that still hasn't gone anywhere...

`PtyMaster` acts like an owned file descriptor, even closing on `Drop`.
Implementing `io::Read` and `io::Write` lets it be used directly in
standard I/O operations.
@cuviper
Copy link
Contributor Author

cuviper commented Apr 21, 2020

OK, CI is green now.

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

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

bors r+

bors bot added a commit that referenced this pull request Apr 22, 2020
1210: impl io::{Read,Write} for PtyMaster r=asomers a=cuviper

`PtyMaster` acts like an owned file descriptor, even closing on `Drop`.
Implementing `io::Read` and `io::Write` lets it be used directly in
standard I/O operations.

Co-authored-by: Josh Stone <[email protected]>
@bors
Copy link
Contributor

bors bot commented Apr 22, 2020

Build failed:

@asomers
Copy link
Member

asomers commented Apr 22, 2020

bors retry

bors bot added a commit that referenced this pull request Apr 22, 2020
1210: impl io::{Read,Write} for PtyMaster r=asomers a=cuviper

`PtyMaster` acts like an owned file descriptor, even closing on `Drop`.
Implementing `io::Read` and `io::Write` lets it be used directly in
standard I/O operations.

Co-authored-by: Josh Stone <[email protected]>
@bors
Copy link
Contributor

bors bot commented Apr 22, 2020

Build failed:

@asomers
Copy link
Member

asomers commented Apr 24, 2020

bors retry

@bors
Copy link
Contributor

bors bot commented Apr 24, 2020

Build succeeded:

@bors bors bot merged commit 9c497e0 into nix-rust:master Apr 24, 2020
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.

3 participants