Open
Conversation
When `GEM_PATH` or `GEM_HOME` are set (e.g. via chruby, rbenv, or launchctl), Ruby prints "Ignoring..." warnings on startup. Since `popen2e` merges stdout and stderr, these warnings corrupt the daemon's port line, causing all ports to parse as 0. Before: REPL crashes with `Errno::EADDRNOTAVAIL` for port 0 when any Ruby version manager is active. After: Daemon and REPL boot cleanly regardless of host gem environment.
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.
Summary
GEM_PATHandGEM_HOMEwhen spawning the daemon to prevent Ruby gem warnings from corrupting the stdout port protocoldaemon.rbto protect the GUI launch path (e.g. if set vialaunchctl setenv)Motivation
When a Ruby version manager (chruby, rbenv, rvm) or system-wide env config sets
GEM_PATH/GEM_HOME, the daemon's Ruby process prints "Ignoring ... because its extensions are not built" warnings on startup. Sincepopen2emerges stdout and stderr, these warnings become the first line read by the port parser, causing all ports to resolve to 0 and crashing withErrno::EADDRNOTAVAIL.This likely affects some of the reported "GUI unable to connect" issues as well (#3371, #3340, #3270).
Before / After
Before: REPL crashes with
Can't assign requested address - connect(2) for "localhost" port 0when any Ruby version manager is active.After: Daemon and REPL boot cleanly regardless of host gem environment.
Test plan
GEM_HOMEandGEM_PATHto a directory with gems built for a different Ruby versionrepl.rb— should boot and reach the>>prompt