summaryrefslogtreecommitdiff
path: root/lib/open3.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-04 23:03:53 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-04 23:03:53 +0000
commit5dbbef2b0219367ad98c5ae172195e0143073bc4 (patch)
tree2491530bcc138313fc44c1973b6ed49987595076 /lib/open3.rb
parent4433defb46f2324baef5a9a2e1b7b40a0391ea5d (diff)
update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/open3.rb')
-rw-r--r--lib/open3.rb31
1 files changed, 14 insertions, 17 deletions
diff --git a/lib/open3.rb b/lib/open3.rb
index e70aaca6ef..08c0af3915 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)>