Closed
Conversation
Before v1.12, IRB avoids loading `~/.irbrc` if the project folder has a `.irbrc` file. So to avoid loading dev's `~/.irbrc`, cfe908c added an empty irbrc fixture as a workaround. However, because IRB v1.12 starts loading `~/.irbrc` even if the project folder has a `.irbrc` file, the workaround no longer works. This commit removes the workaround and uses altering `HOME` environment variable to avoid loading `.irbrc` from devs' home directory instead.
Member
|
Don't |
nobu
reviewed
Mar 9, 2024
|
|
||
| describe "Binding#irb" do | ||
| before :each do | ||
| @env_home = ENV["HOME"] |
Member
There was a problem hiding this comment.
Suggested change
| @env_home = ENV["HOME"] | |
| @envs = ["IRBRC", "XDG_CONFIG_HOME", "HOME"].map {|e| [e, ENV.delete(e)]}.to_h |
| end | ||
|
|
||
| after :each do | ||
| ENV["HOME"] = @env_home |
Member
There was a problem hiding this comment.
Suggested change
| ENV["HOME"] = @env_home | |
| ENV.update(@envs) |
nobu
reviewed
Mar 9, 2024
| irbrc_fixture = fixture __FILE__, "irbrc" | ||
|
|
||
| out = IO.popen([{"IRBRC"=>irbrc_fixture}, *ruby_exe, irb_fixture], "r+") do |pipe| | ||
| out = IO.popen([*ruby_exe, irb_fixture], "r+") do |pipe| |
Member
There was a problem hiding this comment.
Rather how about to change states only in the IO.popen-ed process?
Suggested change
| out = IO.popen([*ruby_exe, irb_fixture], "r+") do |pipe| | |
| dir = CODE_LOADING_DIR | |
| envs = {"IRBRC" => nil, "XDG_CONFIG_HOME" => nil, "HOME" => dir} | |
| out = IO.popen([envs, *ruby_exe, irb_fixture, chdir: dir], "r+") do |pipe| |
Member
|
Could we use irb's |
Member
|
@st0012 Could you check #1141 (comment) ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before v1.12, IRB avoids loading
~/.irbrcif the project folder has a.irbrcfile. So to avoid loading dev's~/.irbrc, cfe908c added an empty irbrc fixture as a workaround.However, because IRB v1.12 starts loading
~/.irbrceven if the project folder has a.irbrcfile, the workaround no longer works.This commit removes the workaround and uses altering
HOMEenvironment variable to avoid loading.irbrcfrom devs' home directory instead.