ruby-changes:59239
From: Nobuyoshi <ko1@a...>
Date: Sat, 14 Dec 2019 00:40:30 +0900 (JST)
Subject: [ruby-changes:59239] 84b873e381 (master): [ruby/irb] Restore environment variables
https://git.ruby-lang.org/ruby.git/commit/?id=84b873e381 From 84b873e381c6928965e36d0a83c899a01b65e646 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 13 Dec 2019 14:35:11 +0900 Subject: [ruby/irb] Restore environment variables https://github.com/ruby/irb/commit/236590882c diff --git a/test/irb/test_init.rb b/test/irb/test_init.rb index 94b32dd..b51d010 100644 --- a/test/irb/test_init.rb +++ b/test/irb/test_init.rb @@ -20,9 +20,9 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_init.rb#L20 end def test_rc_file - ENV.delete("IRBRC") # This is for RVM... + backup_irbrc = ENV.delete("IRBRC") # This is for RVM... + backup_home = ENV["HOME"] Dir.mktmpdir("test_irb_init_#{$$}") do |tmpdir| - backup_home = ENV["HOME"] ENV["HOME"] = tmpdir IRB.conf[:RC_NAME_GENERATOR] = nil @@ -32,15 +32,16 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_init.rb#L32 FileUtils.touch(tmpdir+"/.irb#{IRB::IRBRC_EXT}") assert_equal(tmpdir+"/.irb#{IRB::IRBRC_EXT}", IRB.rc_file) assert_equal(tmpdir+"/.irb_history", IRB.rc_file("_history")) - - ENV["HOME"] = backup_home end + ensure + ENV["HOME"] = backup_home + ENV["IRBRC"] = backup_irbrc end def test_rc_file_in_subdir - ENV.delete("IRBRC") # This is for RVM... + backup_irbrc = ENV.delete("IRBRC") # This is for RVM... + backup_home = ENV["HOME"] Dir.mktmpdir("test_irb_init_#{$$}") do |tmpdir| - backup_home = ENV["HOME"] ENV["HOME"] = tmpdir FileUtils.mkdir_p("#{tmpdir}/mydir") @@ -53,9 +54,10 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_init.rb#L54 assert_equal(tmpdir+"/.irb#{IRB::IRBRC_EXT}", IRB.rc_file) assert_equal(tmpdir+"/.irb_history", IRB.rc_file("_history")) end - - ENV["HOME"] = backup_home end + ensure + ENV["HOME"] = backup_home + ENV["IRBRC"] = backup_irbrc end private -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/