@@ -8779,16 +8779,23 @@ proc_warmup(VALUE _)
8779
8779
*
8780
8780
* == \Process Creation
8781
8781
*
8782
- * Each of these methods creates a process:
8782
+ * Each of the following methods executes a given command in a new process or subshell,
8783
+ * or multiple commands in new processes and/or subshells.
8784
+ * The choice of process or subshell depends on the form of the command;
8785
+ * see {Argument command_line or exe_path}[rdoc-ref:Process@Argument+command_line+or+exe_path].
8783
8786
*
8784
- * - Process.exec: Replaces the current process by running a given external command.
8785
- * - Process.spawn, Kernel#spawn: Executes the given command and returns its pid without waiting for completion.
8786
- * - Kernel#system: Executes the given command in a subshell .
8787
+ * - Process.spawn, Kernel#spawn: Executes the command;
8788
+ * returns the new pid without waiting for completion.
8789
+ * - Process.exec: Replaces the current process by executing the command .
8787
8790
*
8788
- * Each of these methods accepts :
8791
+ * In addition :
8789
8792
*
8790
- * - An optional hash of environment variable names and values.
8791
- * - An optional hash of execution options.
8793
+ * - \Method Kernel#system executes a given command-line (string) in a subshell;
8794
+ * returns +true+, +false+, or +nil+.
8795
+ * - \Method Kernel#` executes a given command-line (string) in a subshell;
8796
+ * returns its $stdout string.
8797
+ * - \Module Open3 supports creating child processes
8798
+ * with access to their $stdin, $stdout, and $stderr streams.
8792
8799
*
8793
8800
* === Execution Environment
8794
8801
*
@@ -8801,7 +8808,6 @@ proc_warmup(VALUE _)
8801
8808
*
8802
8809
* Output:
8803
8810
*
8804
- * nil
8805
8811
* "0"
8806
8812
*
8807
8813
* The effect is usually similar to that of calling ENV#update with argument +env+,
@@ -8813,6 +8819,53 @@ proc_warmup(VALUE _)
8813
8819
* if the new process fails.
8814
8820
* For example, hard resource limits are not restored.
8815
8821
*
8822
+ * === Argument +command_line+ or +exe_path+
8823
+ *
8824
+ * The required string argument is one of the following:
8825
+ *
8826
+ * - +command_line+ if it begins with a shell reserved word or special built-in,
8827
+ * or if it contains one or more meta characters.
8828
+ * - +exe_path+ otherwise.
8829
+ *
8830
+ * <b>Argument +command_line+</b>
8831
+ *
8832
+ * \String argument +command_line+ is a command line to be passed to a shell;
8833
+ * it must begin with a shell reserved word, begin with a special built-in,
8834
+ * or contain meta characters:
8835
+ *
8836
+ * system('if true; then echo "Foo"; fi') # => true # Shell reserved word.
8837
+ * system('echo') # => true # Built-in.
8838
+ * system('date > /tmp/date.tmp') # => true # Contains meta character.
8839
+ * system('date > /nop/date.tmp') # => false
8840
+ * system('date > /nop/date.tmp', exception: true) # Raises RuntimeError.
8841
+ *
8842
+ * The command line may also contain arguments and options for the command:
8843
+ *
8844
+ * system('echo "Foo"') # => true
8845
+ *
8846
+ * Output:
8847
+ *
8848
+ * Foo
8849
+ *
8850
+ * See {Execution Shell}[rdoc-ref:Process@Execution+Shell] for details about the shell.
8851
+ *
8852
+ * <b>Argument +exe_path+</b>
8853
+ *
8854
+ * Argument +exe_path+ is one of the following:
8855
+ *
8856
+ * - The string path to an executable to be called.
8857
+ * - A 2-element array containing the path to an executable to be called,
8858
+ * and the string to be used as the name of the executing process.
8859
+ *
8860
+ * Example:
8861
+ *
8862
+ * system('/usr/bin/date') # => true # Path to date on Unix-style system.
8863
+ * system('foo') # => nil # Command failed.
8864
+ *
8865
+ * Output:
8866
+ *
8867
+ * Mon Aug 28 11:43:10 AM CDT 2023
8868
+ *
8816
8869
* === Execution Options
8817
8870
*
8818
8871
* Optional trailing argument +options+ is a hash of execution options.
0 commit comments