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

Guard doesn't start _guard-core with the same Ruby version it was originally started #878

Open
moll opened this issue Oct 5, 2017 · 4 comments

Comments

@moll
Copy link
Contributor

moll commented Oct 5, 2017

Hey,

I suspect there's a bug in bin/guard due to the way it spawns _guard-core. Namely, with a Gemfile (example below) stating the Ruby version, Bundler may run bin/guard with a Ruby executable not named ruby — such as /usr/bin/ruby24. However, because _guard-core is executed as a regular file and it delegates to /usr/bin/env, the core process is started with the system default Ruby. Fixing it just requires prepending spawn(*args) with Gem.ruby for spawn(Gem.ruby, *args).

Gemfile:

source "https://rubygems.org"
ruby "~> 2.3"
gem "guard"
bundle exec guard

Cheers

@moll
Copy link
Contributor Author

moll commented Oct 5, 2017

I threw in a simple PR should my proposed fix be accepted: #879.

@rymai
Copy link
Member

rymai commented Oct 6, 2017

That makes sense, but I guess your $PATH is not properly configured because which ruby should give you the current Ruby, not the system one?

For example:

› which ruby
/Users/remy/.rubies/ruby-2.3.4/bin/ruby

@moll
Copy link
Contributor Author

moll commented Oct 6, 2017

Nope. This talks about a case when Ruby is not named ruby. Which is on any platform that uses suffixes. ;)

@rymai
Copy link
Member

rymai commented Oct 6, 2017

This talks about a case when Ruby is not named ruby. Which is on any platform that uses suffixes. ;)

Oh, good call! Ok, I guess Gem.ruby doesn't hurt then!

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

2 participants