@@ -2149,6 +2149,9 @@ rb_io_close(io)
2149
2149
* an <code>IOError</code> is raised if such an attempt is made. I/O
2150
2150
* streams are automatically closed when they are claimed by the
2151
2151
* garbage collector.
2152
+ *
2153
+ * If <em>ios</em> is opened by <code>IO.popen</code>,
2154
+ * <code>close</code> sets <code>$?</code>.
2152
2155
*/
2153
2156
2154
2157
static VALUE
@@ -3062,7 +3065,9 @@ pipe_open(pstr, pname, mode)
3062
3065
*
3063
3066
* If a block is given, Ruby will run the command as a child connected
3064
3067
* to Ruby with a pipe. Ruby's end of the pipe will be passed as a
3065
- * parameter to the block. In this case <code>IO::popen</code> returns
3068
+ * parameter to the block.
3069
+ * At the end of block, Ruby close the pipe and sets <code>$?</code>.
3070
+ * In this case <code>IO::popen</code> returns
3066
3071
* the value of the block.
3067
3072
*
3068
3073
* If a block is given with a <i>cmd_string</i> of ``<code>-</code>'',
@@ -3078,6 +3083,7 @@ pipe_open(pstr, pname, mode)
3078
3083
* puts "Parent is #{Process.pid}"
3079
3084
* IO.popen ("date") { |f| puts f.gets }
3080
3085
* IO.popen("-") {|f| $stderr.puts "#{Process.pid} is here, f is #{f}"}
3086
+ * p $?
3081
3087
*
3082
3088
* <em>produces:</em>
3083
3089
*
@@ -3086,6 +3092,7 @@ pipe_open(pstr, pname, mode)
3086
3092
* Wed Apr 9 08:53:52 CDT 2003
3087
3093
* 26169 is here, f is
3088
3094
* 26166 is here, f is #<IO:0x401b3d44>
3095
+ * #<Process::Status: pid=26166,exited(0)>
3089
3096
*/
3090
3097
3091
3098
static VALUE
0 commit comments