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

ruby-changes:30339

From: zzak <ko1@a...>
Date: Tue, 6 Aug 2013 01:42:48 +0900 (JST)
Subject: [ruby-changes:30339] zzak:r42391 (trunk): * process.c: [DOC] Document caveats of command form of Process.spawn

zzak	2013-08-06 01:42:37 +0900 (Tue, 06 Aug 2013)

  New Revision: 42391

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42391

  Log:
    * process.c: [DOC] Document caveats of command form of Process.spawn
      with regard to the shell and OS. Patched by Steve Klabnik [Bug #8550]

  Modified files:
    trunk/ChangeLog
    trunk/process.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42390)
+++ ChangeLog	(revision 42391)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Aug  6 01:40:37 2013  Zachary Scott  <e@z...>
+
+	* process.c: [DOC] Document caveats of command form of Process.spawn
+	  with regard to the shell and OS. Patched by Steve Klabnik [Bug #8550]
+
 Tue Aug  6 01:28:35 2013  Zachary Scott  <e@z...>
 
 	* lib/rss/0.9.rb: [DOC] Typo in example [Bug #8732]
Index: process.c
===================================================================
--- process.c	(revision 42390)
+++ process.c	(revision 42391)
@@ -3864,7 +3864,7 @@ rb_f_system(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L3864
  *      name => nil : unset the environment variable
  *    command...:
  *      commandline                 : command line string which is passed to the standard shell
- *      cmdname, arg1, ...          : command name and one or more arguments (no shell)
+ *      cmdname, arg1, ...          : command name and one or more arguments (This form does not use the shell. See below for caveats.)
  *      [cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell)
  *    options: hash
  *      clearing environment variables:
@@ -3905,6 +3905,14 @@ rb_f_system(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L3905
  *      current directory:
  *        :chdir => str
  *
+ *      The 'cmdname, arg1, ...' form does not use the shell. However,
+ *      on different OSes, different things are provided as built-in
+ *      commands. An example of this is 'echo', which is a built-in
+ *      on Windows, but is a normal program on Linux and Mac OS X.
+ *      This means that `Process.spawn 'echo', '%Path%'` will display
+ *      the contents of the `%Path%` environment variable on Windows,
+ *      but `Process.spawn 'echo', '$PATH'` prints the literal '$PATH'.
+ *
  *  If a hash is given as +env+, the environment is
  *  updated by +env+ before <code>exec(2)</code> in the child process.
  *  If a pair in +env+ has nil as the value, the variable is deleted.

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

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