You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2010/04/12 01:44:41 UTC

svn commit: r933023 - /buildr/trunk/lib/buildr/core/util.rb

Author: boisvert
Date: Sun Apr 11 23:44:41 2010
New Revision: 933023

URL: http://svn.apache.org/viewvc?rev=933023&view=rev
Log:
BUILDR-398: FileUtils#sh does not work correctly on windows
(Part deux)

Modified:
    buildr/trunk/lib/buildr/core/util.rb

Modified: buildr/trunk/lib/buildr/core/util.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/util.rb?rev=933023&r1=933022&r2=933023&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/util.rb (original)
+++ buildr/trunk/lib/buildr/core/util.rb Sun Apr 11 23:44:41 2010
@@ -478,7 +478,15 @@ else
       rake_check_options options, :noop, :verbose
       rake_output_message cmd.join(" ") if options[:verbose]
       unless options[:noop]
-        cd = "cd '#{Dir.pwd}' && "
+        if Buildr::Util.win_os?
+          # Ruby uses forward slashes regardless of platform,
+          # unfortunately cd c:/some/path fails on Windows
+          pwd = Dir.pwd.gsub(%r{/}, '\\')
+          cd = "cd /d \"#{pwd}\" && "
+        else
+          cd = "cd '#{Dir.pwd}' && "
+        end
+
         args = if cmd.size > 1 then cmd[1..cmd.size] else [] end
 
         res = if Buildr::Util.win_os? && cmd.size == 1