[前][次][番号順一覧][スレッド一覧]

ruby-changes:4703

From: ko1@a...
Date: Sat, 26 Apr 2008 02:02:06 +0900 (JST)
Subject: [ruby-changes:4703] akr - Ruby:r16197 (trunk): update spawn rdoc.

akr	2008-04-26 02:01:57 +0900 (Sat, 26 Apr 2008)

  New Revision: 16197

  Modified files:
    trunk/process.c

  Log:
    update spawn rdoc.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/process.c?r1=16197&r2=16196&diff_format=u

Index: process.c
===================================================================
--- process.c	(revision 16196)
+++ process.c	(revision 16197)
@@ -2759,22 +2759,27 @@
  *    # 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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]