Skip to content

Commit df5f2fa

Browse files
[DOC] Correction for Process.spawn doc
1 parent c16aaf1 commit df5f2fa

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

process.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4991,7 +4991,9 @@ rb_f_system(int argc, VALUE *argv, VALUE _)
49914991
*
49924992
* "Hello! 1\n"
49934993
*
4994-
* Ruby invokes the executable directly, with no shell and no shell expansion.
4994+
* Ruby invokes the executable directly.
4995+
* This form does not use the shell;
4996+
* see below for caveats.
49954997
*
49964998
* If one or more +args+ is given, each is an argument or option
49974999
* to be passed to the executable:
@@ -5006,6 +5008,14 @@ rb_f_system(int argc, VALUE *argv, VALUE _)
50065008
* C*
50075009
* hello world
50085010
*
5011+
* The 'cmdname, arg1, ...' form does not use the shell. However,
5012+
* on different OSes, different things are provided as built-in
5013+
* commands. An example of this is 'echo', which is a built-in
5014+
* on Windows, but is a normal program on Linux and Mac OS X.
5015+
* This means that `Process.spawn 'echo', '%Path%'` will display
5016+
* the contents of the `%Path%` environment variable on Windows,
5017+
* but `Process.spawn 'echo', '$PATH'` prints the literal '$PATH'.
5018+
*
50095019
* Raises an exception if the new process could not execute.
50105020
*/
50115021

0 commit comments

Comments
 (0)