-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Check silence_root_warning option to skip warning on root install cmds #4113
Conversation
@@ -8,7 +8,7 @@ def initialize(options) | |||
def run | |||
Bundler.ui.level = "error" if options[:quiet] | |||
|
|||
warn_if_root | |||
warn_if_root unless ENV['SILENCE_ROOT_WARNING'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be done via the bundler config (Bundler.settings[:silence_root_warning]
, which will need to be added as a bool key)
@segiddins I'll fix the style issues later this afternoon. As for the bundler config, I'm not really sure it belongs there as I don't want to avoid the warnings everywhere (i.e. make the setting project-wide) but only on specific environments. Let me hear your thoughts about it. |
@blackxored it does belong in settings, since that's how bundler handles checking for settings. |
I've fixed the style issues, updated to use |
Looks good to me! r+, @indirect ? |
@homu r+ |
📌 Commit b00e4da has been approved by |
Check silence_root_warning option to skip warning on root install cmds Adds a new setting `silence_root_warning` (environment variable: `BUNDLE_SILENCE_ROOT_WARNING`) that skips the default warning when `install` is run as root. The warning is useful but I think it should be able to be disabled if the user knows what he's doing, it's handy when run inside Docker containers (which by default run as root), or other environments where root is used. Also adds a new `preserve_env` option to `bundle` helper in tests which allows running commands under sudo with the `-E` flag (preserve environment) as opposed to the default env_reset. Without this, the command would be run without our flag which makes it impossible to test. There might be cleaner ways to achieve this, though.
☀️ Test successful - status |
This is awesome, thanks so much!!!!!! |
Thanks! I'm now trying to make it the default in the Docker Ruby images, not sure how that'd go. |
Adds a new setting
silence_root_warning
(environment variable:BUNDLE_SILENCE_ROOT_WARNING
) that skips the default warning wheninstall
is run as root.The warning is useful but I think it should be able to be disabled if the user knows what he's doing, it's handy when run inside Docker containers (which by default run as root), or other environments where root is used.
Also adds a new
preserve_env
option tobundle
helper in tests which allows running commands under sudo with the-E
flag (preserve environment) as opposed to the default env_reset. Without this, the command would be run without our flag which makes it impossible to test. There might be cleaner ways to achieve this, though.