Skip to content

Commit d98b15f

Browse files
committed
JT: only use the realpath of the launcher where needed
1 parent 15ef82f commit d98b15f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tool/jt.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ def ruby_launcher
205205
end
206206

207207
raise "The Ruby executable #{ruby_launcher} does not exist" unless File.exist?(ruby_launcher)
208-
ruby_launcher = File.realpath(ruby_launcher)
209-
210208
raise "The Ruby executable #{ruby_launcher} is not executable" unless File.executable?(ruby_launcher)
209+
211210
@ruby_launcher = ruby_launcher
211+
@ruby_launcher_realpath = File.realpath(ruby_launcher)
212212

213213
unless @silent
214214
shortened_path = @ruby_launcher.sub(%r[^#{Regexp.escape TRUFFLERUBY_DIR}/], '').sub(%r[/bin/(ruby|truffleruby)$], '')
@@ -222,13 +222,14 @@ def ruby_launcher
222222

223223
# use same ruby_launcher in subprocess jt instances
224224
# cannot be set while building
225-
ENV['RUBY_BIN'] = ruby_launcher
225+
ENV['RUBY_BIN'] = @ruby_launcher
226226
@ruby_launcher
227227
end
228228
alias_method :require_ruby_launcher!, :ruby_launcher
229229

230230
def ruby_home
231-
File.expand_path('../..', ruby_launcher)
231+
require_ruby_launcher!
232+
File.expand_path('../..', @ruby_launcher_realpath)
232233
end
233234

234235
def graalvm_home
@@ -280,7 +281,8 @@ def truffleruby?
280281
end
281282

282283
def truffleruby_launcher_path
283-
@truffleruby_launcher_path ||= File.join File.dirname(ruby_launcher), 'truffleruby'
284+
require_ruby_launcher!
285+
@truffleruby_launcher_path ||= File.expand_path('../truffleruby', @ruby_launcher_realpath)
284286
end
285287

286288
def truffleruby!

0 commit comments

Comments
 (0)