Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Put BUNDLE_GEMFILE in the env rather than preceding the command
Browse files Browse the repository at this point in the history
Windows doesn't play well with `ENV_VAR=123 command`. We should always
prefer to pass the `env` key instead
  • Loading branch information
vinistock committed Jul 27, 2023
1 parent 613de37 commit 0290113
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,27 +438,20 @@ export default class Client implements ClientInterface {
// If a custom Gemfile was configured outside of the project, use that. Otherwise, prefer our custom bundle over the
// app's bundle
if (customBundleGemfile.length > 0) {
bundleGemfile = `BUNDLE_GEMFILE=${customBundleGemfile}`;
bundleGemfile = customBundleGemfile;
} else if (
fs.existsSync(path.join(this.workingFolder, ".ruby-lsp", "Gemfile"))
) {
bundleGemfile = `BUNDLE_GEMFILE=${path.join(
this.workingFolder,
".ruby-lsp",
"Gemfile",
)}`;
bundleGemfile = path.join(this.workingFolder, ".ruby-lsp", "Gemfile");
} else {
bundleGemfile = `BUNDLE_GEMFILE=${path.join(
this.workingFolder,
"Gemfile",
)}`;
bundleGemfile = path.join(this.workingFolder, "Gemfile");
}

const result = await asyncExec(
`${bundleGemfile} bundle exec ruby -e "require 'ruby-lsp'; print RubyLsp::VERSION"`,
`bundle exec ruby -e "require 'ruby-lsp'; print RubyLsp::VERSION"`,
{
cwd: this.workingFolder,
env: this.ruby.env,
env: { ...this.ruby.env, BUNDLE_GEMFILE: bundleGemfile },
},
);

Expand Down

0 comments on commit 0290113

Please sign in to comment.