summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-27 01:58:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-27 01:58:29 +0000
commit9ce0a846408f28830f5e90387495a2ba9e8c1c2a (patch)
treed02cae16d63248ac2e1e0523adfd9129ac434f2a /tool
parentc03f86b389d00cf45edf133c9aa23479e6efc06e (diff)
rbinstall.rb: fix timing to read stub
* tool/rbinstall.rb ($script_installer.stub): read stub file on demand. as `$cmdtype` is set to "exe" in parse_args, it is not set yet when `$script_installer` is defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rwxr-xr-xtool/rbinstall.rb22
1 files changed, 16 insertions, 6 deletions
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index d0c10ea9f2..c648a4ad57 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -455,14 +455,11 @@ _=_\\
#{prolog_script}=end
EOS
-$script_installer = Struct.new(:ruby_shebang, :ruby_bin, :ruby_install_name,
- :stub, :trans) do
+installer = Struct.new(:ruby_shebang, :ruby_bin, :ruby_install_name, :stub, :trans)
+$script_installer = Class.new(installer) do
ruby_shebang = File.join(bindir, ruby_install_name)
if File::ALT_SEPARATOR
ruby_bin = ruby_shebang.tr(File::SEPARATOR, File::ALT_SEPARATOR)
- if $cmdtype == 'exe'
- stub = File.open("rubystub.exe", "rb") {|f| f.read} << "\n" rescue nil
- end
end
if trans = CONFIG["program_transform_name"]
exp = []
@@ -523,7 +520,20 @@ $script_installer = Struct.new(:ruby_shebang, :ruby_bin, :ruby_install_name,
end
end
- break new(ruby_shebang, ruby_bin, ruby_install_name, stub, trans)
+ def self.get_rubystub
+ stubfile = "rubystub.exe"
+ stub = File.open(stubfile, "rb") {|f| f.read} << "\n"
+ rescue => e
+ abort "No #{stubfile}: #{e}"
+ else
+ stub
+ end
+
+ def stub
+ super or self.stub = self.class.get_rubystub
+ end
+
+ break new(ruby_shebang, ruby_bin, ruby_install_name, nil, trans)
end
install?(:local, :comm, :bin, :'bin-comm') do