From: JJ Date: 2008-01-07T05:14:59+09:00 Subject: Ruby's Kernel::exec (and system and %x) I was reading about Kernel::exec (and the related Kernel::system function and %x operator). These routines follow the Perl-ish idiom, which is "If there is one argument, pass it to the shell; if there is more than one argument, execute it directly". I call it the Perl-ish idiom simply because that is the first place I saw this one-exec-routine-to-serve-them-all behavior. Now, there is a serious limitation to this, which exists on all platforms that allow shell meta-characters in file names (space, asterisk, etc). I usually come across the bug when running applications on Windows. The problem is this: exec("C:\\Program Files\\Anything\\Foo.exe"); Since this is a one-argument call to Kernel::exec, Ruby passes it to the command interpreter, which tries to split the single argument on shell meta-characters as it would for "echo *" or "ls -al". However, "C:\\Program" is not the executable that we desire. In Perl, one can force the no-shell-interpreter path by calling exec (and system) like so: my $cmd = "C:\\Program Files\\..."; exec( { $cmd } $cmd ); Is there any such option in Ruby? -JJ