Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chruby cannot successfully switch to mruby-3.0.0 under Fish #44

Open
todd-a-jacobs opened this issue May 1, 2022 · 0 comments
Open

Comments

@todd-a-jacobs
Copy link

todd-a-jacobs commented May 1, 2022

Description

chruby cannot successfully switch to mruby-3.0.0 under Fish, but seems to work as expected under Bash in spite of raising a Ruby NoMethodError exception when attempting to change rubies. The latter issue was raised upstream with chruby.

Steps To Reproduce

Steps to reproduce the bug:

  1. ruby-install mruby-3.0.0
  2. exec fish --login, which is required for chruby to pick up the newly installed Ruby
  3. chruby mruby or chruby mruby-3.0.0
  4. chruby, which shows that the selected Ruby hasn't changed

Expected Behavior

chruby-fish should not halt execution or report a different exit status than chruby itself. If the Ruby exception is not a show-stopper, then chruby-fish should not halt execution when the Bash version of chruby continues, and should change to the requested Ruby under the same circumstances that the Bash version of chruby does.

Actual Behavior

My default Ruby is currently set to Ruby 3.1.2. ruby-install mruby-3.0.0 succeeds without error. Under Bash, the following error still occurs:

$ bash --version | head -1
GNU bash, version 5.1.16(1)-release (x86_64-apple-darwin20.6.0)

$ chruby mruby
trace (most recent call last):
-:1: undefined method 'defined?' (NoMethodError)

but the current Ruby is changed to mruby-3.0.0, RUBY_ROOT is set correctly, and mirb is executable. However, under Fish, the script exits non-zero. This error stops chruby from switching the current Ruby, and RUBY_ROOT and other variables remain unchanged.

~> bash -c 'echo $BASH_VERSION'
5.1.16(1)-release

~> echo $FISH_VERSION 
3.4.1

~> chruby mruby
trace (most recent call last):
-:1: undefined method 'defined?' (NoMethodError)

[I] user@localhost ~ [1]> chruby
   jruby-9.3.4.0
   mruby-3.0.0
   ruby-2.7.0
   ruby-2.7.5
   ruby-3.0.3
   ruby-3.0.4
   ruby-3.1.0
   ruby-3.1.1
 * ruby-3.1.2
   ruby-3.2.0-preview1
   truffleruby-22.1.0
   truffleruby-graalvm-22.1.0

~> chruby --version
chruby: 0.3.9
chruby-fish: 0.8.2

 ~> gem env | sed "s/$(id -un)/\$LOGNAME/g"
RubyGems Environment:
  - RUBYGEMS VERSION: 3.3.7
  - RUBY VERSION: 3.1.2 (2022-04-12 patchlevel 20) [x86_64-darwin20]
  - INSTALLATION DIRECTORY: /Users/$LOGNAME/.gem/ruby/3.1.2
  - USER INSTALLATION DIRECTORY: /Users/$LOGNAME/.gem/ruby/3.1.0
  - RUBY EXECUTABLE: /Users/$LOGNAME/.rubies/ruby-3.1.2/bin/ruby
  - GIT EXECUTABLE: /usr/local/bin/git
  - EXECUTABLE DIRECTORY: /Users/$LOGNAME/.gem/ruby/3.1.2/bin
  - SPEC CACHE DIRECTORY: /Users/$LOGNAME/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/$LOGNAME/.rubies/ruby-3.1.2/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-darwin-20
  - GEM PATHS:
     - /Users/$LOGNAME/.gem/ruby/3.1.2
     - /Users/$LOGNAME/.rubies/ruby-3.1.2/lib/ruby/gems/3.1.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["https://rubygems.org"]
     - :concurrent_downloads => 4
     - "gem" => "--env-shebang --minimal-deps --no-document --patch --suggestions --wrappers"
  - REMOTE SOURCES:
     - https://rubygems.org
  - SHELL PATH:
     - /Users/$LOGNAME/.gem/ruby/3.1.2/bin
     - /Users/$LOGNAME/.rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/bin
     - /Users/$LOGNAME/.rubies/ruby-3.1.2/bin
     - /Users/$LOGNAME/bin
     - /Users/$LOGNAME/perl5/bin
     - /usr/local/bin
     - /usr/local/sbin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/puppetlabs/pdk/bin
     - /opt/X11/bin
     - /opt/puppetlabs/bin
     - /Library/Apple/usr/bin
     - /Users/$LOGNAME/bin
     - /Users/$LOGNAME/perl5/bin
     - /usr/local/sbin
     - /usr/local/opt/openssl/bin
     - /usr/local/Cellar/python@3.9/3.9.12/libexec/bin
     - /usr/local/opt/openssl@1.1/bin
     - /usr/local/opt/openssl@3/bin
     - /Users/$LOGNAME/.local/bin/jetbrains
     - /usr/local/opt/v8@3.15/bin
     - /usr/local/opt/gcc/bin
     - /Users/$LOGNAME/node_modules/bin
     - /Users/$LOGNAME/go/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant