Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.4, JRuby 1.5
-
Fix Version/s: JRuby 1.6RC1
-
Component/s: Core Classes/Modules, Intro
-
Labels:None
-
Environment:Windows XP SP 3; Java 1.6.0; jruby 1.4.0 and 1.5.0
-
Number of attachments :
Description
Demonstrate with this simple test:
- Create batch file: C:\testdir\batchdir\test.bat containing:
echo "This is test.bat"
- Create ruby file: C:\testdir\test.rb containing:
paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR) paths.unshift "c:\\testdir\\batchdir" ENV["PATH"] = paths.uniq.join(File::PATH_SEPARATOR) Kernel.exec "test.bat" - And run:
C:\testdir>jruby test.rb test.rb:9: No such file or directory - test.bat (Errno::ENOENT) - But using binary Ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] it works just fine:
C:\testdir>ruby test.rb C:\testdir>echo "This is test.bat" "This is test.bat"
I found this when trying to use Bundler's 'bundle exec' command, which uses the same technique.
Issue Links
- is duplicated by
-
JRUBY-5098
Kernel#exec does not heed ENV['PATH'] when launching shell command
-
In test.rb, the unshift line is supposed to read:
paths.unshift "c:\\testdir\ \batchdir"
...without any spaces. This online editor is breaking the line on the second pair of backslashes