mirror of
https://github.com/rbenv/ruby-build.git
synced 2025-10-23 22:30:26 +02:00
Transform JRuby shebangs to absolute paths, fixing recursion within rbenv
The default shebang for binstubs in a JRuby installation is `#!/usr/bin/env jruby`. On a rbenv-managed JRuby, this will execute the `jruby` rbenv shim. In a situation where a JRuby tool like `gem` is executed from within a running rbenv by a rbenv plugin, (e.g. rbenv-gemset) this can trigger another rbenv run to resolve the shim. This can lead to endless recursion of rbenv calls. Fixes #471, closes #473 References jf/rbenv-gemset#56
This commit is contained in:
parent
8ebfd1d0a9
commit
76b632892b
1 changed files with 9 additions and 0 deletions
|
@ -507,6 +507,7 @@ build_package_jruby() {
|
|||
ln -fs jruby ruby
|
||||
install_jruby_launcher
|
||||
remove_windows_files
|
||||
fix_jruby_shebangs
|
||||
}
|
||||
|
||||
install_jruby_launcher() {
|
||||
|
@ -515,6 +516,14 @@ install_jruby_launcher() {
|
|||
} >&4 2>&1
|
||||
}
|
||||
|
||||
fix_jruby_shebangs() {
|
||||
for file in "${PREFIX_PATH}/bin"/*; do
|
||||
if [ "$(head -c 20 "$file")" = "#!/usr/bin/env jruby" ]; then
|
||||
sed -i '' -E "1s:.+:#\!${PREFIX_PATH}/bin/jruby:" "$file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
remove_windows_files() {
|
||||
cd "$PREFIX_PATH"
|
||||
rm -f bin/*.exe bin/*.dll bin/*.bat bin/jruby.sh
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue