diff options
author | Burdette Lamar <BurdetteLamar@Yahoo.com> | 2023-10-01 18:37:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-01 19:37:40 -0400 |
commit | f9490110e156d1cd5221433d3c1f41b0cfab1d01 (patch) | |
tree | 4a8b4bc069f6258f8fb339ad7e51a76c7bcc4b49 /process.c | |
parent | 4909747e5a1b49bb6a707727d5e43a61e37e7818 (diff) |
[DOC] Another example for spawn (#8575)
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -4952,18 +4952,24 @@ rb_f_system(int argc, VALUE *argv, VALUE _) * * 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 - * and the string to be used as the name of the executing process. + * - The string path to an executable to be called: * - * Example: + * spawn('/usr/bin/date') # Path to date on Unix-style system. + * Process.wait * - * spawn('/usr/bin/date') # => 799198 # Path to date on Unix-style system. - * Process.wait # => 799198 + * Output: * - * Output: + * Thu Aug 31 10:06:48 AM CDT 2023 + * + * - A 2-element array containing the path to an executable + * and the string to be used as the name of the executing process: + * + * pid = spawn(['sleep', 'Hello!'], '1') # 2-element array. + * p `ps -p #{pid} -o command=` + * + * Output: * - * Thu Aug 31 10:06:48 AM CDT 2023 + * "Hello! 1\n" * * Ruby invokes the executable directly, with no shell and no shell expansion. * |