summaryrefslogtreecommitdiff
path: root/runruby.rb
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-28 09:42:41 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-28 09:42:41 +0000
commitb87dd6747453d645f467e21e38924290f497c2e4 (patch)
tree787971c46852ebbd2a4b416a1961ce31cb3e0cb6 /runruby.rb
parent6f92f56042cb9ce4a290f5eda4535e423d589570 (diff)
merges r21102 from trunk into ruby_1_9_1.
* runruby.rb: refactored to modify ENV as once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'runruby.rb')
-rwxr-xr-xrunruby.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/runruby.rb b/runruby.rb
index 8b0e9c20e5..c439784042 100755
--- a/runruby.rb
+++ b/runruby.rb
@@ -44,28 +44,36 @@ if extout
end
libs << File.expand_path("lib", srcdir)
config["bindir"] = abs_archdir
-ENV["RUBY"] = File.expand_path(ruby)
-ENV["PATH"] = [abs_archdir, ENV["PATH"]].compact.join(File::PATH_SEPARATOR)
+
+env = {}
+
+env["RUBY"] = File.expand_path(ruby)
+env["PATH"] = [abs_archdir, ENV["PATH"]].compact.join(File::PATH_SEPARATOR)
if pure
libs << File.expand_path("ext", srcdir) << "-"
elsif e = ENV["RUBYLIB"]
libs |= e.split(File::PATH_SEPARATOR)
end
-ENV["RUBYLIB"] = $:.replace(libs).join(File::PATH_SEPARATOR)
+env["RUBYLIB"] = $:.replace(libs).join(File::PATH_SEPARATOR)
libruby_so = File.join(abs_archdir, config['LIBRUBY_SO'])
if File.file?(libruby_so)
if e = config['LIBPATHENV'] and !e.empty?
- ENV[e] = [abs_archdir, ENV[e]].compact.join(File::PATH_SEPARATOR)
+ env[e] = [abs_archdir, ENV[e]].compact.join(File::PATH_SEPARATOR)
end
if /linux/ =~ RUBY_PLATFORM
- ENV["LD_PRELOAD"] = [libruby_so, ENV["LD_PRELOAD"]].compact.join(' ')
+ env["LD_PRELOAD"] = [libruby_so, ENV["LD_PRELOAD"]].compact.join(' ')
end
end
+ENV.update env
+
cmd = [ruby]
cmd << "-rpurelib.rb" if pure
cmd.concat(ARGV)
cmd.unshift(*debugger) if debugger
+
+#require 'shellwords'; puts Shellwords.join(env.map {|k,v| "#{k}=#{v}" } + cmd)
+
exec(*cmd)