Bug #1010: Ruby-1.9's rake sh doesn't work on Windows (but fix provided)
http://redmine.ruby-lang.org/issues/show/1010

Author: Chauk-Mean Proum
Status: Open, Priority: High
Target version: 1.9.1 RC2
Reproducible Version: 1.9.1 RC1

Hi,

I'm reporting this issue in Rake as rake is now part of Ruby-1.9 and this problem affects only Ruby-1.9.

For Windows, FileUtils#sh (in rake.rb) calls Rake::Win32.rake_system (in rake/win32.rb) defined as :

def rake_system(*cmd)
  if cmd.size == 1
    system("call #{cmd}")   # The problem is here with ruby-1.9
  else
    system(*cmd)
  end
end

With ruby-1.9 on Windows :
  sh "my_foo_command"
will result in
  call ["my_foo_command"]
which will result in syntax error due to [ and ].

With ruby-1.8, the result is :
call my_foo_command

The fix is simple : replace the "call #{cmd}" with "call #{cmd[0]}"

def rake_system(*cmd)
  if cmd.size == 1
    system("call #{cmd[0]}") # fix for 1.9 but works fine with 1.8
  else
    system(*cmd)
  end
end

Chauk-Mean.


----------------------------------------
http://redmine.ruby-lang.org