diff options
author | Burdette Lamar <BurdetteLamar@Yahoo.com> | 2023-11-08 08:26:27 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-08 09:26:27 -0500 |
commit | d80009d1693fe3288be265ecc53ade362d89de59 (patch) | |
tree | c3a4c81d1dd47e3cbfe4081cd4e8ecc1357dbf34 /process.c | |
parent | f694bd158c4aaffbbb9e4b2f0608c6d428a4999c (diff) | |
download | ruby-d80009d1693fe3288be265ecc53ade362d89de59.tar.gz |
[DOC] RDoc for module Process (#8847)
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 69 |
1 files changed, 61 insertions, 8 deletions
@@ -8779,16 +8779,23 @@ proc_warmup(VALUE _) * * == \Process Creation * - * Each of these methods creates a process: + * Each of the following methods executes a given command in a new process or subshell, + * or multiple commands in new processes and/or subshells. + * The choice of process or subshell depends on the form of the command; + * see {Argument command_line or exe_path}[rdoc-ref:Process@Argument+command_line+or+exe_path]. * - * - Process.exec: Replaces the current process by running a given external command. - * - Process.spawn, Kernel#spawn: Executes the given command and returns its pid without waiting for completion. - * - Kernel#system: Executes the given command in a subshell. + * - Process.spawn, Kernel#spawn: Executes the command; + * returns the new pid without waiting for completion. + * - Process.exec: Replaces the current process by executing the command. * - * Each of these methods accepts: + * In addition: * - * - An optional hash of environment variable names and values. - * - An optional hash of execution options. + * - \Method Kernel#system executes a given command-line (string) in a subshell; + * returns +true+, +false+, or +nil+. + * - \Method Kernel#` executes a given command-line (string) in a subshell; + * returns its $stdout string. + * - \Module Open3 supports creating child processes + * with access to their $stdin, $stdout, and $stderr streams. * * === Execution Environment * @@ -8801,7 +8808,6 @@ proc_warmup(VALUE _) * * Output: * - * nil * "0" * * The effect is usually similar to that of calling ENV#update with argument +env+, @@ -8813,6 +8819,53 @@ proc_warmup(VALUE _) * if the new process fails. * For example, hard resource limits are not restored. * + * === Argument +command_line+ or +exe_path+ + * + * The required string argument is one of the following: + * + * - +command_line+ if it begins with a shell reserved word or special built-in, + * or if it contains one or more meta characters. + * - +exe_path+ otherwise. + * + * <b>Argument +command_line+</b> + * + * \String argument +command_line+ is a command line to be passed to a shell; + * it must begin with a shell reserved word, begin with a special built-in, + * or contain meta characters: + * + * system('if true; then echo "Foo"; fi') # => true # Shell reserved word. + * system('echo') # => true # Built-in. + * system('date > /tmp/date.tmp') # => true # Contains meta character. + * system('date > /nop/date.tmp') # => false + * system('date > /nop/date.tmp', exception: true) # Raises RuntimeError. + * + * The command line may also contain arguments and options for the command: + * + * system('echo "Foo"') # => true + * + * Output: + * + * Foo + * + * See {Execution Shell}[rdoc-ref:Process@Execution+Shell] for details about the shell. + * + * <b>Argument +exe_path+</b> + * + * Argument +exe_path+ is one of the following: + * + * - The string path to an executable to be called. + * - A 2-element array containing the path to an executable to be called, + * and the string to be used as the name of the executing process. + * + * Example: + * + * system('/usr/bin/date') # => true # Path to date on Unix-style system. + * system('foo') # => nil # Command failed. + * + * Output: + * + * Mon Aug 28 11:43:10 AM CDT 2023 + * * === Execution Options * * Optional trailing argument +options+ is a hash of execution options. |