Skip to content

Commit

Permalink
Ensure tapioca gem command executes in a clean env
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrocha committed Jan 22, 2025
1 parent 3540c7c commit af07bac
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions lib/ruby_lsp/tapioca/run_gem_rbi_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,22 @@ def generate_gem_rbis

sig { params(gems: T::Array[String]).void }
def execute_tapioca_gem_command(gems)
# Resetting BUNDLE_GEMFILE to root folder to use the project's Gemfile instead of Ruby LSP's composed Gemfile
stdout, stderr, status = T.unsafe(Open3).capture3(
{ "BUNDLE_GEMFILE" => "Gemfile" },
"bundle",
"exec",
"tapioca",
"gem",
"--lsp_addon",
*gems,
)

log_message(stdout) unless stdout.empty?
log_message(stderr) unless stderr.empty?
@result.status = status
Bundler.with_unbundled_env do
# Resetting BUNDLE_GEMFILE to root folder to use the project's Gemfile instead of Ruby LSP's composed Gemfile
stdout, stderr, status = T.unsafe(Open3).capture3(
{ "BUNDLE_GEMFILE" => "Gemfile" },
"bundle",
"exec",
"tapioca",
"gem",
"--lsp_addon",
*gems,
)

log_message(stdout) unless stdout.empty?
log_message(stderr) unless stderr.empty?
@result.status = status
end
end

sig { params(gems: T::Array[String]).void }
Expand Down

0 comments on commit af07bac

Please sign in to comment.