Skip to content

Run test subprocesses outside the parent Bundler env#2225

Merged
soutaro merged 1 commit into
soutaro:masterfrom
rhiroe:fix/test-subprocess-bundle-env
May 28, 2026
Merged

Run test subprocesses outside the parent Bundler env#2225
soutaro merged 1 commit into
soutaro:masterfrom
rhiroe:fix/test-subprocess-bundle-env

Conversation

@rhiroe

@rhiroe rhiroe commented May 18, 2026

Copy link
Copy Markdown
Contributor

Under Bundler 4, require "bundler/setup" exports BUNDLE_LOCKFILE into ENV (a new behaviour since 2/3 -- see set_bundle_variables), so ShellHelper#sh! leaks it into child processes. The binstub tests then run bundle install in a tmpdir whose Gemfile uses gem "steep", path: ..., and the inherited BUNDLE_LOCKFILE causes that install to rewrite this project's Gemfile.lock -- dropping the optional development group and breaking subsequent bundle execs with Could not find gem 'stackprof mri'.

Wrap the Open3 calls in Bundler.with_unbundled_env so each child starts with a clean Bundler env.

Under Bundler 4, `require "bundler/setup"` exports `BUNDLE_LOCKFILE`
into ENV (a new behaviour since 2/3 -- see `set_bundle_variables`),
so `ShellHelper#sh!` leaks it into child processes. The binstub
tests then run `bundle install` in a tmpdir whose Gemfile uses
`gem "steep", path: ...`, and the inherited `BUNDLE_LOCKFILE` causes
that install to rewrite this project's `Gemfile.lock` -- dropping
the optional `development` group and breaking subsequent
`bundle exec`s with `Could not find gem 'stackprof mri'`.

Wrap the `Open3` calls in `Bundler.with_unbundled_env` so each child
starts with a clean Bundler env.
@soutaro soutaro added this to the Steep 2.1 milestone May 28, 2026
@soutaro soutaro merged commit d9e1884 into soutaro:master May 28, 2026
20 of 21 checks passed
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

Successfully merging this pull request may close these issues.

2 participants