Skip to content

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

Closed
@stepancheg

Description

@stepancheg

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions