From: Tanaka Akira Date: 2012-12-06T17:18:23+09:00 Subject: [ruby-core:50624] Re: [ruby-trunk - Bug #7489][Open] Kernel.spawn sometimes executes string directly 2012/12/2 jcaesar (Julius Caesar) : > 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