aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorDoug Hazell2017-02-19 02:12:46 +0000
committerDoug Hazell2017-02-19 02:12:46 +0000
commit5d1576784a5603662ca9910eb97c948e833f35c9 (patch)
tree76554a8122b5863a138d8feb4e6a0da82f318efc /Library
parentadc43466a6c3d807344e0350e8d1776c4bd78a31 (diff)
downloadbrew-5d1576784a5603662ca9910eb97c948e833f35c9.tar.bz2
Mechanism to dynamically add HOMEBREW.* vars to 'env -i' command string in 'bin/brew'
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Homebrew/utils/homebrew_vars.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/Library/Homebrew/utils/homebrew_vars.rb b/Library/Homebrew/utils/homebrew_vars.rb
new file mode 100755
index 000000000..057633b77
--- /dev/null
+++ b/Library/Homebrew/utils/homebrew_vars.rb
@@ -0,0 +1,11 @@
+#!/usr/bin/env ruby
+
+ENV.keys.each do |key|
+ if key =~ /^HOMEBREW.*/
+ # Remove any HOMEBREW.* vars containing white-space which causes a problem for "env -i" command via string.
+ #
+ # (Any user supplied HOMEBREW.* vars with valid white-space need to be hard-coded in 'bin/brew')
+ #
+ puts "#{key}=#{ENV[key]}" unless ENV[key].split(' ').length > 1
+ end
+end