Skip to content

Commit

Permalink
Generate the bundle path before cleaning the env
Browse files Browse the repository at this point in the history
When `Gem.bin_path("bundler", "bundle")` is used inside `with_unbundled_env`
it can return `nil`, thus breaking the command. By storing the path
outside of the block we ensure to grab a working path instead.

Also removed the unused `env` argument.
  • Loading branch information
elia committed Nov 2, 2022
1 parent 04440bc commit bd271e9
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ def call(frontend)

private

def bundle_command(command, env = {})
def bundle_command(command)
@generator_context.say_status :run, "bundle #{command}"
bundle_path = Gem.bin_path("bundler", "bundle")

BundlerContext.bundle_cleanly do
system(
Gem.ruby,
Gem.bin_path("bundler", "bundle"),
bundle_path,
*command.shellsplit,
)
end
Expand Down

0 comments on commit bd271e9

Please sign in to comment.