From c1575836273665b5fad8828c45238ce1bee157c7 Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 15 Jan 2009 13:45:06 +0000 Subject: rdoc update. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/io.c b/io.c index 14fb46bcdc..c302156a03 100644 --- a/io.c +++ b/io.c @@ -4790,13 +4790,15 @@ pop_last_hash(int *argc_p, VALUE *argv) * The last argument opt qualifies mode. * * # set IO encoding - * nkf_io = IO.popen("nkf -e filename", :external_encoding=>"EUC-JP") - * euc_jp_string = nkf_io.read + * IO.popen("nkf -e filename", :external_encoding=>"EUC-JP") {|nkf_io| + * euc_jp_string = nkf_io.read + * } * * # merge standard output and standard error using * # spawn option. See the document of Kernel.spawn. - * ls_io = IO.popen(["ls", "/", :err=>[:child, :out]]) - * ls_result_with_error = ls_io.read + * IO.popen(["ls", "/", :err=>[:child, :out]]) {|ls_io| + * ls_result_with_error = ls_io.read + * } * * Raises exceptions which IO.pipe and * Kernel.spawn raise. @@ -4818,9 +4820,10 @@ pop_last_hash(int *argc_p, VALUE *argv) * * f = IO.popen("uname") * p f.readlines + * f.close * puts "Parent is #{Process.pid}" * IO.popen("date") { |f| puts f.gets } - * IO.popen("-") {|f| $stderr.puts "#{Process.pid} is here, f is #{f}"} + * IO.popen("-") {|f| $stderr.puts "#{Process.pid} is here, f is #{f.inspect}"} * p $? * IO.popen(%w"sed -e s|^|| -e s&$&;zot;&", "r+") {|f| * f.puts "bar"; f.close_write; puts f.gets @@ -4829,11 +4832,11 @@ pop_last_hash(int *argc_p, VALUE *argv) * produces: * * ["Linux\n"] - * Parent is 26166 - * Wed Apr 9 08:53:52 CDT 2003 - * 26169 is here, f is - * 26166 is here, f is # - * # + * Parent is 21346 + * Thu Jan 15 22:41:19 JST 2009 + * 21346 is here, f is # + * 21352 is here, f is nil + * # * bar;zot; */ -- cgit v1.2.3