-
Notifications
You must be signed in to change notification settings - Fork 182
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
bundle: "Could not find command" error #2862
Comments
Thank you for the report! We added those as part of fixing #2532. To compose the Ruby LSP bundle, we start by executing the gem without The issue was that if the version of Bundler we had required during setup didn't match the one in the lockfile, Bundler would itself replace the current process with I initially tried to fix it by only setting The only way I found to make Bundler both not restart and create a If you have more context on Bundler and what a more adequate way of fixing this is, I'm happy to change our approach. Maybe the fact that it locks the composed bundle to a different version is irrelevant and we can just set I'd love to fully escape having to worry about the binstubs because we have no guarantees about what it supports. |
@vinistock Thank you for taking time to respond in-depth! I did not know that there were as complicated edge-cases as what you are describing, and I must admit I do not have a suggestion about how this could be handled better. I do know that Rubygems binstubs will always have the comment |
…issues (#2987) ### Motivation Closes #2862 and #2731 (comment) Clearly, adding the Bundler version to the command causes trouble for people using binstubs in certain configurations. I think I found a way to continue specifying the version, which guarantees that RubyGems will eagerly activate the right specification, while at the same time avoiding those issues. ### Implementation The idea is to invoke the original Bundler binstub generated by RubyGems directly. That way, even if there's a custom binstub, we avoid invoking it and use the default one (which accepts the version). ### Automated Tests Managed to write a test that fails before this fix. ### Manual tests 1. Create an executable file `bin/bundle` 2. Add this code to the executable ```ruby #!/usr/bin/env ruby raise "This should not be called" ``` 3. Add the bin directory to your PATH temporary: `export PATH ./bin:$PATH` 4. Verify that booting the LSP does not fail `exe/ruby-lsp`
Description
Ruby LSP Information
VS Code Version
1.95.3
Ruby LSP Extension Version
0.8.13
Ruby LSP Server Version
Unknown
Ruby LSP Addons
Ruby Version
3.0.7
Ruby Version Manager
none
Installed Extensions
Click to expand
Ruby LSP Settings
Click to expand
Workspace
User
Reproduction steps
BUNDLE_BIN=path/to/binstubs bundle binstub --all
path/to/binstubs
to PATHI suspect this is because the
<command> _<version>_
invocation syntax might be supported by binstubs generated by Rubygems, but is not supported by binstubs generated by Bundler. Furthermore, it's entirely unnecessary to explicitly specify a Bundler version: first of all, this version likely comes from a Gemfile.lock, and Bundler already has a mechanism to activate the right bundler version according to the lockfile. Second, the Ruby LSP extension also seems to set the BUNDLER_VERSION environment variable before invokingbundle
(which I also think is unnecessary):ruby-lsp/lib/ruby_lsp/setup_bundler.rb
Lines 399 to 405 in 9e24cff
The text was updated successfully, but these errors were encountered: