Re-launch assets:precompile task using original $0 if $0 is batch file so it works on Windows #4735

merged 1 commit into from Jan 31, 2012

3 participants


MSWin32 version of ruby provides Windows batch file that converted from original script files.
The batch file is not plain ruby script, so the patch provided by #3121 (comment) causes error on Windows.

C:\tmp\webtest>rake assets:precompile
c:/Users/arton/bin/ruby.exe c:/Users/arton/rake.bat assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
c:/Users/arton/bin/rake.bat:1: syntax error, unexpected tIDENTIFIER, expecting $end
rake aborted!
Command failed with status (1): [c:/Users/arton/bin/ruby.exe c:/U... (omitted by the poster)

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

So, this patch checks $0 is batch file or not. And if $0 is batch file, then run it with Kernel.exec (means Win32 API) instead of ruby.


@tenderlove tenderlove merged commit 77c6706 into rails:master Jan 31, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment