ruby-changes:4719
From: ko1@a...
Date: Sun, 27 Apr 2008 01:47:52 +0900 (JST)
Subject: [ruby-changes:4719] akr - Ruby:r16213 (trunk): * lib/open3.rb (Open3.popen3w): removed.
akr 2008-04-27 01:47:30 +0900 (Sun, 27 Apr 2008)
New Revision: 16213
Modified files:
trunk/ChangeLog
trunk/lib/open3.rb
Log:
* lib/open3.rb (Open3.popen3w): removed.
(Open3.popen3): notice wait_thr.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16213&r2=16212&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/open3.rb?r1=16213&r2=16212&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 16212)
+++ ChangeLog (revision 16213)
@@ -1,3 +1,8 @@
+Sun Apr 27 01:46:29 2008 Tanaka Akira <akr@f...>
+
+ * lib/open3.rb (Open3.popen3w): removed.
+ (Open3.popen3): notice wait_thr.
+
Sun Apr 27 01:13:05 2008 Eric Hodel <drbrain@s...>
* lib/rdoc, test/rdoc: Update to RDoc 2.0.0 r56.
Index: lib/open3.rb
===================================================================
--- lib/open3.rb (revision 16212)
+++ lib/open3.rb (revision 16213)
@@ -9,65 +9,38 @@
#
#
-# Open3 grants you access to stdin, stdout, and stderr when running another
-# program. Example:
+# 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 = popen3('nroff -man')
+# stdin, stdout, stderr, wait_thr = popen3('nroff -man')
#
-# If the exit status of the child process is required, Open3.popen3w is usable.
+# 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.
#
-# Open3.popen3 can also take a block which will receive stdin, stdout and
-# stderr as parameters. This ensures stdin, stdout and stderr are closed
-# once the block exits. Example:
+# Example:
#
# require "open3"
#
-# Open3.popen3('nroff -man') { |stdin, stdout, stderr| ... }
+# Open3.popen3('nroff -man') { |stdin, stdout, stderr, wait_thr| ... }
#
module Open3
#
# Open stdin, stdout, and stderr streams and start external executable.
- #
- # Non-block form:
- #
- # stdin, stdout, stderr = Open3.popen3(cmd)
- # ...
- # stdin.close # stdin, stdout and stderr should be closed in this form.
- # stdout.close
- # stderr.close
- #
- # Block form:
- #
- # Open3.popen3(cmd) { |stdin, stdout, stderr| ... }
- # # stdin, stdout and stderr is closed automatically in this form.
- #
- # The parameter +cmd+ is passed directly to Kernel#spawn.
- #
- def popen3(*cmd)
- if defined? yield
- popen3w(*cmd) {|stdin, stdout, stderr, wait_thr|
- yield stdin, stdout, stderr
- }
- else
- stdin, stdout, stderr, wait_thr = popen3w(*cmd)
- return stdin, stdout, stderr
- end
- end
- module_function :popen3
-
- #
- # Open stdin, stdout, and stderr streams and start external executable.
# In addition, a thread for waiting the started process is noticed.
# The thread has a thread variable :pid which is the pid of the started
# process.
#
# Non-block form:
#
- # stdin, stdout, stderr, wait_thr = Open3.popen3w(cmd)
+ # stdin, stdout, stderr, wait_thr = Open3.popen3(cmd)
# pid = wait_thr[:pid] # pid of the started process.
# ...
# stdin.close # stdin, stdout and stderr should be closed in this form.
@@ -77,7 +50,7 @@
#
# Block form:
#
- # Open3.popen3w(cmd) { |stdin, stdout, stderr, wait_thr| ... }
+ # Open3.popen3(cmd) { |stdin, stdout, stderr, wait_thr| ... }
#
# The parameter +cmd+ is passed directly to Kernel#spawn.
#
@@ -86,7 +59,7 @@
#
# Closing stdin, stdout and stderr does not wait the process.
#
- def popen3w(*cmd)
+ def popen3(*cmd)
pw = IO::pipe # pipe[0] for read, pipe[1] for write
pr = IO::pipe
pe = IO::pipe
@@ -109,7 +82,7 @@
end
pi
end
- module_function :popen3w
+ module_function :popen3
end
if $0 == __FILE__
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/