fix(io): handle missing source in stdin#534
Open
dignifiedquire wants to merge 2 commits intoDataDog:masterfrom
Open
fix(io): handle missing source in stdin#534dignifiedquire wants to merge 2 commits intoDataDog:masterfrom
dignifiedquire wants to merge 2 commits intoDataDog:masterfrom
Conversation
Currently `io::stdin()` when used with `lines().fuse()` from `futures`, will panic on the first poll. This adds a test for this case, as well as a potential fix.
dignifiedquire
commented
Feb 23, 2022
| let res = match source.result() { | ||
| Some(res) => res, | ||
| None => { | ||
| return Poll::Pending; |
Contributor
Author
There was a problem hiding this comment.
I don't know if this is the correct fix, but it does fix both the test case and when using stdin in my program to read from it
Contributor
Author
|
it seems the missing stdin on CI is failing the tests, any suggestions on how to adjust such that it actually tests the right thing? |
Member
|
The fix looks good, but your new unit test is failing in CI. I'll try to find some time to reproduce locally to see what's going on. This new test relies on timing, though, and generally, that's best avoided. |
Contributor
Author
|
it doesn’t actually rely on timing, just the fact that nothing gets written to stdin and that it is available |
616409a to
d480c63
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently
io::stdin()when used withlines().fuse()fromfutures, will panic on the first poll. This adds a test for thiscase, as well as a potential fix.