From 0bd6f36aa73059022fd5dd9cc2462cb4b785ba25 Mon Sep 17 00:00:00 2001 From: zzak Date: Mon, 5 Aug 2013 16:42:37 +0000 Subject: [PATCH] * process.c: [DOC] Document caveats of command form of Process.spawn with regard to the shell and OS. Patched by Steve Klabnik [Bug #8550] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ process.c | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 980f8552d9..9c1ca1ff18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Aug 6 01:40:37 2013 Zachary Scott + + * process.c: [DOC] Document caveats of command form of Process.spawn + with regard to the shell and OS. Patched by Steve Klabnik [Bug #8550] + Tue Aug 6 01:28:35 2013 Zachary Scott * lib/rss/0.9.rb: [DOC] Typo in example [Bug #8732] diff --git a/process.c b/process.c index 7ea74ca2fd..363595c766 100644 --- a/process.c +++ b/process.c @@ -3864,7 +3864,7 @@ rb_f_system(int argc, VALUE *argv) * name => nil : unset the environment variable * command...: * commandline : command line string which is passed to the standard shell - * cmdname, arg1, ... : command name and one or more arguments (no shell) + * cmdname, arg1, ... : command name and one or more arguments (This form does not use the shell. See below for caveats.) * [cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell) * options: hash * clearing environment variables: @@ -3905,6 +3905,14 @@ rb_f_system(int argc, VALUE *argv) * current directory: * :chdir => str * + * The 'cmdname, arg1, ...' form does not use the shell. However, + * on different OSes, different things are provided as built-in + * commands. An example of this is 'echo', which is a built-in + * on Windows, but is a normal program on Linux and Mac OS X. + * This means that `Process.spawn 'echo', '%Path%'` will display + * the contents of the `%Path%` environment variable on Windows, + * but `Process.spawn 'echo', '$PATH'` prints the literal '$PATH'. + * * If a hash is given as +env+, the environment is * updated by +env+ before exec(2) in the child process. * If a pair in +env+ has nil as the value, the variable is deleted.