Open todd-a-jacobs opened 2 years ago
Ah, this was fixed by c44c6cc656104ab1d800d437313c967c59d9303a, which probably should get a patch release. The other bug is that chruby_use
is not checking$?
before executing the output of the ruby command. Something like this should catch it:
local ruby_env="$(RUBYGEMS_GEMDEPS="" "$RUBY_ROOT/bin/ruby" - <<EOF
puts "export RUBY_ENGINE=#{Object.const_defined?(:RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'};"
puts "export RUBY_VERSION=#{RUBY_VERSION};"
begin; require 'rubygems'; puts "export GEM_ROOT=#{Gem.default_dir.inspect};"; rescue LoadError; end
EOF)"
if (( $? != 0 )); then
echo "chruby: failed to execute $1/bin/ruby command" >&2
return -1
fi
Description
ruby-install sucessfully installs mruby-3.0.0 without errors. However, chruby reports a successful exit status under Bash, but still throws a Ruby exception when attempting to switch to mruby.
Whatever the underlying error is, it causes chruby-fish to exit non-zero, which prevents chruby from switching to mruby at all. This has been reported separately to chruby-fish as a related issue.
Steps To Reproduce
Steps to reproduce the bug:
ruby-install mruby-3.0.0
exec bash
, which is required for chruby to pick up the newly installed Rubychruby mruby; echo
orchruby mruby-3.0.0
Expected Behavior
chruby should either exit non-zero if there's an error during the switch, or not display an error if the Ruby exception raised is expected.
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 occurs:The current Ruby is still changed to mruby-3.0.0, RUBY_ROOT is set correctly, and mirb is executable.
Environment