castwide / ruby-spawn

A cross-platform Ruby process function for Node.js.
Other
5 stars 2 forks source link

ruby-spawn incompatible with asdf-vm #1

Open ndan opened 3 years ago

ndan commented 3 years ago

I can't make ruby-debug work with asdf-vm.

The only way to make it work is to remove shellArgs.unshift('-l'); from the ruby-spawn source code.

I can replicate an error in terminal

$ /bin/zsh -l -c "cd /path/to/project/website_api && bundle exec readapt serve"
Traceback (most recent call last):
    2: from /usr/bin/bundle:23:in `<main>'
    1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.2.11) required by your /path/to/project/website_api/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.2.11`

It works if I remove -l

$ /bin/zsh -c "cd /path/to/project/website_api && bundle exec readapt serve"
Readapt Debugger 0.8.1 is listening HOST=127.0.0.1 PORT=1234 PID=38677

Any chance shellArgs.unshift('-l'); can be removed from the source code?

ENV

MacOS BigSur (11.2.1) asdf-vm v0.8.0 VSCode 1.53.2

castwide commented 3 years ago

The problem with removing -l is that it would break ruby-spawn on some systems using rvm or rbenv.

You might be able to work around the problem by tweaking your zsh profile, although I'm not familiar enough with asdf to make any specific recommendations. In the meantime, I'll see if I can come up with a better solution. I'm open to suggestions.

ndan commented 3 years ago

Adding export PATH=$HOME/.asdf/shims:$PATH to ~/.zprofile works fine.

I need further investigation to understand what is the difference between rbenv and asdf.