diff options
author | Eric Wong <e@yhbt.net> | 2010-09-25 17:55:07 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2010-09-25 17:55:07 +0000 |
commit | d8ee79e1e5c6e6908009213324db25cf41c583ce (patch) | |
tree | 7806c74d5cbe04edebae47ab2b1d708b1f078f27 | |
parent | af03e4471de3d3b91eec16e26e93a84d4a717116 (diff) | |
download | kgio-d8ee79e1e5c6e6908009213324db25cf41c583ce.tar.gz |
Just like IO#read
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | ext/kgio/kgio_ext.c | 2 | ||||
-rw-r--r-- | test/lib_read_write.rb | 2 | ||||
-rw-r--r-- | test/test_pipe_popen.rb | 2 |
4 files changed, 3 insertions, 5 deletions
@@ -1,5 +1,3 @@ * more API documentation -* return (instead of raise) EOFError? - * SSL/TLS support diff --git a/ext/kgio/kgio_ext.c b/ext/kgio/kgio_ext.c index d0632e3..f2d30ba 100644 --- a/ext/kgio/kgio_ext.c +++ b/ext/kgio/kgio_ext.c @@ -114,7 +114,7 @@ static int read_check(struct io_args *a, long n, const char *msg) } rb_str_set_len(a->buf, n); if (n == 0) - rb_eof_error(); + a->buf = Qnil; return 0; } diff --git a/test/lib_read_write.rb b/test/lib_read_write.rb index 897e6b2..18f13f0 100644 --- a/test/lib_read_write.rb +++ b/test/lib_read_write.rb @@ -16,7 +16,7 @@ module LibReadWriteTest def test_read_eof @wr.close - assert_raises(EOFError) { @rd.kgio_read 5 } + assert_nil @rd.kgio_read(5) end def test_write_closed diff --git a/test/test_pipe_popen.rb b/test/test_pipe_popen.rb index af72032..1f56979 100644 --- a/test/test_pipe_popen.rb +++ b/test/test_pipe_popen.rb @@ -9,6 +9,6 @@ class TestPipePopen < Test::Unit::TestCase assert_equal Kgio::WaitReadable, io.kgio_read(2) sleep 1.5 assert_equal "HI\n", io.kgio_read(3) - assert_raises(EOFError) { io.kgio_read 5 } + assert_nil io.kgio_read(5) end end |