@@ -3114,7 +3114,9 @@ NORETURN(static VALUE f_exec(int c, const VALUE *a, VALUE _));
3114
3114
*
3115
3115
* Sat Aug 26 09:38:00 AM CDT 2023
3116
3116
*
3117
- * Ruby invokes the executable directly, with no shell and no shell expansion:
3117
+ * Ruby invokes the executable directly.
3118
+ * This form does not use the shell;
3119
+ * see {Arguments args}[rdoc-ref:Process@Arguments+args] for caveats.
3118
3120
*
3119
3121
* exec('doesnt_exist') # Raises Errno::ENOENT
3120
3122
*
@@ -4820,7 +4822,9 @@ rb_spawn(int argc, const VALUE *argv)
4820
4822
* system('foo') # => nil
4821
4823
* $? # => #<Process::Status: pid 645608 exit 127>
4822
4824
*
4823
- * Ruby invokes the executable directly, with no shell and no shell expansion:
4825
+ * Ruby invokes the executable directly.
4826
+ * This form does not use the shell;
4827
+ * see {Arguments args}[rdoc-ref:Process@Arguments+args] for caveats.
4824
4828
*
4825
4829
* system('doesnt_exist') # => nil
4826
4830
*
@@ -4985,7 +4989,7 @@ rb_f_system(int argc, VALUE *argv, VALUE _)
4985
4989
*
4986
4990
* Ruby invokes the executable directly.
4987
4991
* This form does not use the shell;
4988
- * see below for caveats.
4992
+ * see {Arguments args}[rdoc-ref:Process@Arguments+args] for caveats.
4989
4993
*
4990
4994
* If one or more +args+ is given, each is an argument or option
4991
4995
* to be passed to the executable:
@@ -5000,14 +5004,6 @@ rb_f_system(int argc, VALUE *argv, VALUE _)
5000
5004
* C*
5001
5005
* hello world
5002
5006
*
5003
- * The 'cmdname, arg1, ...' form does not use the shell. However,
5004
- * on different OSes, different things are provided as built-in
5005
- * commands. An example of this is 'echo', which is a built-in
5006
- * on Windows, but is a normal program on Linux and Mac OS X.
5007
- * This means that `Process.spawn 'echo', '%Path%'` will display
5008
- * the contents of the `%Path%` environment variable on Windows,
5009
- * but `Process.spawn 'echo', '$PATH'` prints the literal '$PATH'.
5010
- *
5011
5007
* Raises an exception if the new process could not execute.
5012
5008
*/
5013
5009
@@ -8843,7 +8839,7 @@ proc_warmup(VALUE _)
8843
8839
* or if it contains one or more meta characters.
8844
8840
* - +exe_path+ otherwise.
8845
8841
*
8846
- * <b> Argument +command_line+</b>
8842
+ * ==== Argument +command_line+
8847
8843
*
8848
8844
* \String argument +command_line+ is a command line to be passed to a shell;
8849
8845
* it must begin with a shell reserved word, begin with a special built-in,
@@ -8865,7 +8861,7 @@ proc_warmup(VALUE _)
8865
8861
*
8866
8862
* See {Execution Shell}[rdoc-ref:Process@Execution+Shell] for details about the shell.
8867
8863
*
8868
- * <b> Argument +exe_path+</b>
8864
+ * ==== Argument +exe_path+
8869
8865
*
8870
8866
* Argument +exe_path+ is one of the following:
8871
8867
*
@@ -8892,6 +8888,40 @@ proc_warmup(VALUE _)
8892
8888
*
8893
8889
* "Hello! 1\n"
8894
8890
*
8891
+ * === Arguments +args+
8892
+ *
8893
+ * If +command_line+ does not contain shell meta characters except for
8894
+ * spaces and tabs, or +exe_path+ is given, Ruby invokes the
8895
+ * executable directly. This form does not use the shell:
8896
+ *
8897
+ * spawn("doesnt_exist") # Raises Errno::ENOENT
8898
+ * spawn("doesnt_exist", "\n") # Raises Errno::ENOENT
8899
+ *
8900
+ * spawn("doesnt_exist\n") # => false
8901
+ * # sh: 1: doesnot_exist: not found
8902
+ *
8903
+ * The error message is from a shell and would vary depending on your
8904
+ * system.
8905
+ *
8906
+ * If one or more +args+ is given after +exe_path+, each is an
8907
+ * argument or option to be passed to the executable:
8908
+ *
8909
+ * Example:
8910
+ *
8911
+ * system('echo', '<', 'C*', '|', '$SHELL', '>') # => true
8912
+ *
8913
+ * Output:
8914
+ *
8915
+ * < C* | $SHELL >
8916
+ *
8917
+ * However, on different OSes, different things are provided as
8918
+ * built-in commands. An example of this is +'echo'+, which is a
8919
+ * built-in on Windows, but is a normal program on Linux and Mac OS X.
8920
+ * This means that <code>Process.spawn 'echo', '%Path%'</code> will
8921
+ * display the contents of the <tt>%Path%</tt> environment variable on
8922
+ * Windows, but <code>Process.spawn 'echo', '$PATH'</code> prints the
8923
+ * literal <tt>$PATH</tt>.
8924
+ *
8895
8925
* === Execution Options
8896
8926
*
8897
8927
* Optional trailing argument +options+ is a hash of execution options.
0 commit comments