Project

General

Profile

Actions

Bug #1010

closed

Ruby-1.9's rake sh doesn't work on Windows (but fix provided)

Added by Chauk-Mean (Chauk-Mean Proum) over 15 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
Backport:
[ruby-core:21339]

Description

=begin
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.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0