Hello all.

I'm puzzled by the behaviour of Process.spawn.  Allow me to
illustrate, with the following short program:

----------------------
puts 'Executing first command...'
Process.spawn 'sh -c :'
sleep 2   # give it time to finish
puts 'Executing second command...'
Process.spawn ':'
----------------------

On my system (which runs Debian Linux 6.0), the output is as follows:

----------------------
Executing first command...
Executing second command...
spawn-experiment:4:in `spawn': No such file or directory - :
(Errno::ENOENT)
        from spawn-experiment:4:in `<main>'
----------------------

`strace' shows that, for the second call to `spawn', ruby tries
to execute the command directly, without passing it to the shell.
This appears to contradict the documentation at [1].  Is this a bug?

[1] http://www.ruby-doc.org/core-1.9.3/Process.html#method-c-spawn

Some details about my setup.  The output of "ruby -v" is:

  ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

The output of "uname -a" is:

  Linux asteroid 2.6.32-5-amd64 #1 SMP Sun Sep 23 10:07:46 UTC 2012
x86_64 GNU/Linux

-- 
Posted via http://www.ruby-forum.com/.