diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-02-01 03:12:21 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-02-01 03:12:21 +0000 |
commit | e4b53b22228d935847b72e8f9ab0f49a15b54215 (patch) | |
tree | ae6cd78921bf626d54145b5485474bf59c3dceb4 /io.c | |
parent | 005f12582975d8382851b740690f97dba35aaa2a (diff) | |
download | ruby-e4b53b22228d935847b72e8f9ab0f49a15b54215.tar.gz |
2000-02-01
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -1576,7 +1576,12 @@ rb_io_s_popen(argc, argv, self) } Check_SafeStr(pname); port = pipe_open(RSTRING(pname)->ptr, mode); - if (NIL_P(port)) return Qnil; + if (NIL_P(port)) { + rb_yield(port); + } + else if (rb_iterator_p()) { + return rb_ensure(rb_yield, port, rb_io_close, port); + } return port; } @@ -1647,8 +1652,10 @@ rb_f_open(argc, argv) } port = pipe_open(RSTRING(pname)->ptr+1, mode); - if (NIL_P(port)) return Qnil; - if (rb_iterator_p()) { + if (NIL_P(port)) { + rb_yield(port); + } + else if (rb_iterator_p()) { return rb_ensure(rb_yield, port, rb_io_close, port); } @@ -3222,7 +3229,7 @@ Init_IO() rb_rs = rb_default_rs = rb_str_new2("\n"); rb_output_rs = Qnil; rb_global_variable(&rb_default_rs); - rb_str_freeze(rb_default_rs); /* avoid modifying RS_default */ + OBJ_FREEZE(rb_default_rs); /* avoid modifying RS_default */ rb_define_hooked_variable("$/", &rb_rs, 0, rb_str_setter); rb_define_hooked_variable("$-0", &rb_rs, 0, rb_str_setter); rb_define_hooked_variable("$\\", &rb_output_rs, 0, rb_str_setter); |