Skip to content

Commit 1b3784c

Browse files
committed
Don't raise EndOfFile when stdin::read reaches EOF.
Just return `None' as stipulated by the `Reader' trait. Fixes rust-lang#11104.
1 parent ba801d8 commit 1b3784c

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/libstd/io/stdio.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ use option::{Option, Some, None};
3232
use result::{Ok, Err};
3333
use io::buffered::LineBufferedWriter;
3434
use rt::rtio::{DontClose, IoFactory, LocalIo, RtioFileStream, RtioTTY};
35-
use super::{Reader, Writer, io_error, IoError, OtherIoError,
36-
standard_error, EndOfFile};
35+
use super::{Reader, Writer, io_error, IoError, OtherIoError};
3736

3837
// And so begins the tale of acquiring a uv handle to a stdio stream on all
3938
// platforms in all situations. Our story begins by splitting the world into two
@@ -202,10 +201,7 @@ impl Reader for StdReader {
202201
// return an actual EOF error, but apparently for stdin it's a
203202
// little different. Hence, here we convert a 0 length read to an
204203
// end-of-file indicator so the caller knows to stop reading.
205-
Ok(0) => {
206-
io_error::cond.raise(standard_error(EndOfFile));
207-
None
208-
}
204+
Ok(0) => None,
209205
Ok(amt) => Some(amt as uint),
210206
Err(e) => {
211207
io_error::cond.raise(e);

0 commit comments

Comments
 (0)