2012/12/2 jcaesar (Julius Caesar) <redmine / ruby-lang.org>:

> Bug #7489: Kernel.spawn sometimes executes string directly
> https://bugs.ruby-lang.org/issues/7489

> Kernel.spawn throws an exception in certain cases where it shouldn't.
> It seems to attempt to execute the command directly, rather than passing
> it to the shell.

Ruby invokes simple commands, command line without meta characters, directly
without shell.  This behavior is inherited from Perl.

We cannot remove the behavior because people assumes pid returned from
Kernel.spawn (and IO#pid for IO.popen) is the pid of invoked simple command.
If we use always invoke a command via shell, people will find they cannot
kill the command because returned pid will be the pid of shell, not the command.

However, Ruby 2.0 refines the algorithm to use shell or not.
So, your example will fail as you expected.
-- 
Tanaka Akira