diff options
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -6852,6 +6852,7 @@ argf_forward(int argc, VALUE *argv, VALUE argf) static void argf_close(VALUE file) { + if (file == rb_stdin) return; if (RB_TYPE_P(file, T_FILE)) { rb_io_set_write_io(file, Qnil); } @@ -6881,6 +6882,14 @@ argf_next_argv(VALUE argf) } ARGF.init_p = 1; } + else { + if (NIL_P(ARGF.argv)) { + ARGF.next_p = -1; + } + else if (ARGF.next_p == -1 && RARRAY_LEN(ARGF.argv) > 0) { + ARGF.next_p = 1; + } + } if (ARGF.next_p == 1) { retry: @@ -7262,6 +7271,7 @@ argf_readlines(int argc, VALUE *argv, VALUE argf) ARGF.lineno = lineno + RARRAY_LEN(ary); ARGF.last_lineno = ARGF.lineno; } + ARGF.init_p = 0; return ary; } |