summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-25 17:01:57 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-25 17:01:57 +0000
commit8e8095dd885466fc379c2b033334c3d0f04ae507 (patch)
tree96d11991bbb00dac33cfae2dbf6bf8303c90f6f6 /process.c
parente72b9cbc44d896ab2bc54cdf42f7b0962bb90dde (diff)
update spawn rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/process.c b/process.c
index 25349b6da6..a6fc8c7a06 100644
--- a/process.c
+++ b/process.c
@@ -2759,22 +2759,27 @@ rb_f_system(int argc, VALUE *argv)
* # standard output and standard error is redirected to log file.
* pid = spawn(command, [STDOUT, STDERR]=>["log", "w"])
*
- * It is possible to specify a file descriptor to close using
- * <code>:close</code>.
+ * spawn closes all non-standard unspecified descriptors by default.
+ * The "standard" descriptors are 0, 1 and 2.
+ * This behavior is specified by :close_others option.
*
- * # similar to IO.popen
- * r, w = IO.pipe
- * pid = spawn(command, STDOUT=>w, r=>:close, w=>:close)
- * w.close
+ * pid = spawn(command, :close_others=>true) # close 3,4,5,... (default)
+ * pid = spawn(command, :close_others=>false) # don't close 3,4,5,...
*
- * Also, all non-standard unspecified descriptors can be closed by :close_others option.
- * The "standard" descriptors are 0, 1 and 2.
+ * :close_others is true by default for spawn and IO.popen.
*
- * # more similar to IO.popen
+ * So IO.pipe and spawn can be used as IO.popen.
+ *
+ * # similar to r = IO.popen(command)
* r, w = IO.pipe
- * pid = spawn(command, STDOUT=>w, :close_others=>true)
+ * pid = spawn(command, STDOUT=>w) # r, w is closed in the child process.
* w.close
*
+ * :close is specified as a hash value to close a fd individualy.
+ *
+ * f = open(foo)
+ * system(command, f=>:close) # don't inherit f.
+ *
* It is also possible to exchange file descriptors.
*
* pid = spawn(command, STDOUT=>STDERR, STDERR=>STDOUT)