Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundler: switch from deprecated with_clean_env to with_original_env #1794

Closed
wants to merge 1 commit into from
Closed

Bundler: switch from deprecated with_clean_env to with_original_env #1794

wants to merge 1 commit into from

Conversation

bensie
Copy link
Contributor

@bensie bensie commented May 9, 2019

with_clean_env blows away all "BUNDLE_*" environment variables without consideration for the ones that you may have wanted to retain. It's also deprecated. For example, starting your server with BUNDLE_GEMFILE=Gemfile.rails6 would delete this environment variable on app restart when using prune_bundler, when all you really want is to restore the environment to what it was before Bundler was activated.

The environment preserver provided by Bundler goes to greater lengths to avoid stomping on things that are intended to be preserved and with_original_env is a beautiful thing.

with_clean_env blows away all BUNDLE_ environment variables without consideration
for the ones that you may have wanted. For example, starting your server with
BUNDLE_GEMFILE=Gemfile.rails6 would delete this envrionment variable on app
restart when using prune_bundler, when all you really want is to restore the
environment to what it was before Bundler was activated.
@nateberkopec
Copy link
Member

Looks like it was un-deprecated rubygems/bundler#6843

@nateberkopec
Copy link
Member

It would be helpful if you could include a test describing the behavior you laid out in your description.

@bensie
Copy link
Contributor Author

bensie commented May 9, 2019

No problem @nateberkopec, I'm on it. Thanks for taking an initial look!

@nateberkopec nateberkopec added waiting-for-changes Waiting on changes from the requestor and removed Needs Feedback labels Jun 3, 2019
@nateberkopec
Copy link
Member

👋 Any luck? need help?

@AlexWayfer
Copy link
Contributor

AlexWayfer commented Feb 19, 2020

Looks like it was un-deprecated rubygems/bundler#6843

No, with_clear_env is still deprecated and should be replaced with with_unbundled_env or with with_original_env if you want another behavior.

@bensie, can you please update the code?

@nateberkopec, can you please re-open the PR? Or should I open a new one?

UPD: But I think with_original_env is more accurate and the code in this PR should not be changed.

@nateberkopec
Copy link
Member

Please open a new one.

@dentarg
Copy link
Member

dentarg commented Feb 19, 2020

I will just note that @seven1m tried to use with_original_env in #1893, see the comment about it at https://github.com/puma/puma/pull/1893/files#r379535248

@AlexWayfer
Copy link
Contributor

I will just note that @seven1m tried to use with_original_env in #1893, see the comment about it at https://github.com/puma/puma/pull/1893/files#r379535248

Oh, this Travis! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
restart waiting-for-changes Waiting on changes from the requestor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants