=begin
To reproduce on Windows:
Create a batch file with one argument in a folder that has a space in its name. In Ruby call:
system('"c:\your full path\batchfile.bat" yourparam')
It will behave as if the quotations are missing. (Error: c:\your is not recognized as a command...)
=end
At Fri, 20 Mar 2009 02:42:11 +0900,
Borislav Stanimirov wrote in [ruby-core:22960]:
To reproduce on Windows:
Create a batch file with one argument in a folder that has a space in its name. In Ruby call:
system('"c:\your full path\batchfile.bat" yourparam')
It will behave as if the quotations are missing. (Error: c:\your is not recognized as a command...)
So I tested it some more and if the arguments have no quoutations it works ok. Here is an even simpler case that reproduces the bug:
Test.cmd:
echo %1 %2
Test.rb:
system('"C:/New Folder/test.cmd" "a" b') #=>'C:/New' is not recognized as an internal or external command,
operable program or batch file.
#system('"C:/New Folder/test.cmd" a b') works
=begin
According to the document of CreateProcess (http://msdn.microsoft.com/en-us/library/ms682425.aspx) :
To run a batch file, you must start the command interpreter; set lpApplicationName to cmd.exe and set lpCommandLine to the following arguments: /c plus the name of the batch file.
Here is a quick patch:
--- win32.c 2009-01-16 00:37:20.000000000 +0900
+++ win32.c.new 2009-03-20 19:08:24.000000000 +0900
@@ -1002,6 +1002,10 @@
command_found:
shell = p;
translate_char(p, '/', '\');