From 828f3ecfcdbc740bc9eedbfc946576ad9aeaa43f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 21 Jan 2024 19:14:41 +0900 Subject: [PATCH] [DOC] Move `exe_path` example to `Process` module document Exchanged with `Kernel.spawn`, like as `Kernel.exec` and `Kernel.system`. This description should be common for these methods. --- process.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/process.c b/process.c index 8a28a9e760..8ea7bb888a 100644 --- a/process.c +++ b/process.c @@ -4972,24 +4972,16 @@ 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: + * - 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. * * spawn('/usr/bin/date') # Path to date on Unix-style system. * Process.wait * * 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: - * - * "Hello! 1\n" + * Mon Aug 28 11:43:10 AM CDT 2023 * * Ruby invokes the executable directly. * This form does not use the shell; @@ -8877,18 +8869,28 @@ proc_warmup(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 to be called, - * and the string to be used as the name of the executing process. + * - The string path to an executable to be called: * - * Example: + * Example: * - * system('/usr/bin/date') # => true # Path to date on Unix-style system. - * system('foo') # => nil # Command failed. + * system('/usr/bin/date') # => true # Path to date on Unix-style system. + * system('foo') # => nil # Command execlution failed. * - * Output: + * Output: * - * Mon Aug 28 11:43:10 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: + * + * Example: + * + * pid = spawn(['sleep', 'Hello!'], '1') # 2-element array. + * p `ps -p #{pid} -o command=` + * + * Output: + * + * "Hello! 1\n" * * === Execution Options *