diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-04 23:03:53 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-04 23:03:53 +0000 |
| commit | 9f65986afcef11e375b7087c40ae88567b79c51f (patch) | |
| tree | 2491530bcc138313fc44c1973b6ed49987595076 /lib/open3.rb | |
| parent | 6c21d166b19b7f45594c80b7548dbce602fe86cf (diff) | |
| download | ruby-9f65986afcef11e375b7087c40ae88567b79c51f.tar.gz ruby-9f65986afcef11e375b7087c40ae88567b79c51f.tar.xz ruby-9f65986afcef11e375b7087c40ae88567b79c51f.zip | |
update rdoc.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/open3.rb')
| -rw-r--r-- | lib/open3.rb | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/lib/open3.rb b/lib/open3.rb index e70aaca6e..08c0af391 100644 --- a/lib/open3.rb +++ b/lib/open3.rb @@ -12,23 +12,15 @@ # Open3 grants you access to stdin, stdout, stderr and a thread to wait the # child process when running another program. # -# Example: -# -# require "open3" -# include Open3 -# -# stdin, stdout, stderr, wait_thr = popen3('nroff -man') -# -# Open3.popen3 can also take a block which will receive stdin, stdout, -# stderr and wait_thr as parameters. -# This ensures stdin, stdout and stderr are closed and -# the process is terminated once the block exits. -# -# Example: -# -# require "open3" -# -# Open3.popen3('nroff -man') { |stdin, stdout, stderr, wait_thr| ... } +# - Open3.popen3 : pipes for stdin, stdout, stderr +# - Open3.popen2 : pipes for stdin, stdout +# - Open3.popen2e : pipes for stdin, merged stdout and stderr +# - Open3.poutput3 : give a string for stdin. get strings for stdout, stderr +# - Open3.poutput2 : give a string for stdin. get a string for stdout +# - Open3.poutput2e : give a string for stdin. get a string for merged stdout and stderr +# - Open3.pipeline_rw : pipes for stdin of the first and stdout of the last of a pipeline +# - Open3.pipeline_r : pipe for stdout of the last of a pipeline +# - Open3.pipeline_w : pipe for stdin of the first of a pipeline # module Open3 @@ -332,6 +324,11 @@ module Open3 # # Example: # + # fname = "/usr/share/man/man1/ls.1.gz" + # Open3.pipeline_r(["zcat", fname], "nroff -man", "colcrt") {|r, ts| + # IO.copy_stream(r, STDOUT) + # } + # # Open3.pipeline_r("yes", "head -10") {|r, ts| # p r.read #=> "y\ny\ny\ny\ny\ny\ny\ny\ny\ny\n" # p ts[0].value #=> #<Process::Status: pid 24910 SIGPIPE (signal 13)> |
