[DOC] Another example for spawn (#8575)
This commit is contained in:
parent
4909747e5a
commit
f9490110e1
20
process.c
20
process.c
@ -4952,19 +4952,25 @@ rb_f_system(int argc, VALUE *argv, VALUE _)
|
|||||||
*
|
*
|
||||||
* Argument +exe_path+ is one of the following:
|
* Argument +exe_path+ is one of the following:
|
||||||
*
|
*
|
||||||
* - The string path to an executable to be called.
|
* - 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.
|
|
||||||
*
|
*
|
||||||
* 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
|
* 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:
|
||||||
|
*
|
||||||
|
* "Hello! 1\n"
|
||||||
|
*
|
||||||
* Ruby invokes the executable directly, with no shell and no shell expansion.
|
* Ruby invokes the executable directly, with no shell and no shell expansion.
|
||||||
*
|
*
|
||||||
* If one or more +args+ is given, each is an argument or option
|
* If one or more +args+ is given, each is an argument or option
|
||||||
|
Loading…
x
Reference in New Issue
Block a user