-
-
Notifications
You must be signed in to change notification settings - Fork 2k
bundle exec's "with_original_env" doesn't preserve PATH #4251
Comments
In #2369 I can find:
On the other hand the
There's an implementation to pass along the original environment in another environment variable |
Thanks for the report! It looks like this is a bug. The intention is that |
@indirect isn't this what |
Preserve PATH in with_clean_env Closes #4251? Not sure.
Preserve PATH in with_clean_env Closes #4251? Not sure.
Unfortunately not completely. You can check by running this spec: njam@8871e41 |
@segiddins sounds like we maybe want to pull in that spec? |
Go ahead @indirect |
Refactor path/environment preserver, make it always preserve the PATH Closes #4251 @segiddins @indirect @RochesterinNYC wdyt?
I'm looking for a way to restore the original environment PATH inside a ruby script executed with
bundle exec <script>
. I understandBundler.with_original_env
( andBundler.with_clean_env
) should provide this functionality.It seems to me though that the PATH is not correctly preserved when running
bundle exec
, becauselib/bundler.rb
is loaded twice during such an execution (once when running thebundle
binary, and once when executing the script withKernel.exec('<script>')
incli/exec.rb
).Therefore
Bundler.ORIGINAL_ENV
is overwritten twice, and can't be restored to the original value.To illustrate I've added a spec about this here (which fails): njam@8871e41
I think the only way to pass along the original environment to the sub process is by setting yet another environment variable. Maybe bundler should store the environment serialized in
BUNDLE_ORIGINAL_ENV
, and then load it from there if present?Is this interpretation correct, or am I using the code wrong?
The text was updated successfully, but these errors were encountered: