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

Reader::read raises EndOfFile condition when reading after EOF reached #11104

Closed
stepancheg opened this issue Dec 21, 2013 · 1 comment
Closed

Comments

@stepancheg
Copy link
Contributor

Code:

use std::io;

fn main() {
    let mut stdin = io::stdin();
    let mut buf = ~[0u8, ..10];
    let r1 = stdin.read(buf);
    let r2 = stdin.read(buf);
}

Execute as:

echo hi | ./tmp

Result is:

task '<main>' failed at 'Unhandled condition: io_error: io::IoError{kind: EndOfFile, desc: "End of file", detail: None}', /Users/yozh/devel/left/rust/src/libstd/condition.rs:131

Result should be None according to Reader::read documentation (returns None on EOF).

$ rustc --version
rustc 0.9-pre (52769b6 2013-12-18 22:41:36 -0800)
host: x86_64-apple-darwin
spaolacci added a commit to spaolacci/rust that referenced this issue Dec 23, 2013
Just return `None' as stipulated by the `Reader' trait. Fixes rust-lang#11104.
@alexcrichton
Copy link
Member

Sorry I didn't get around to this earlier, but as with #11126 I'm closing this as working-as-intended.

flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 14, 2023
…entri3

`arc_with_non_send_sync`: reword and move to `suspicious`

Fixes rust-lang#11079

changelog: [`arc_with_non_send_sync`]: move to complexity
flip1995 pushed a commit to flip1995/rust that referenced this issue Aug 17, 2023
…entri3

`arc_with_non_send_sync`: reword and move to `suspicious`

Fixes rust-lang#11079

changelog: [`arc_with_non_send_sync`]: move to complexity
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 a pull request may close this issue.

2 participants