aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
authorMike McQuaid2013-03-10 17:03:17 +0000
committerMike McQuaid2013-03-11 18:26:25 +0000
commit9837bbda550a45b7748f7d888c2b25d5a73abc03 (patch)
tree9251674668cff8a0687f7d9953bbbb799d3d24b9 /Library/Homebrew/utils.rb
parentd39280bdf7aca09ea7c6d9acf927bd95b6d1e499 (diff)
downloadbrew-9837bbda550a45b7748f7d888c2b25d5a73abc03.tar.bz2
Add with_system_path to run using system PATHs.
Needed for Linux compatibility.
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 955c1e8f2..a6b093acc 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -99,6 +99,14 @@ module Homebrew
end
end
+def with_system_path
+ old_path = ENV['PATH']
+ ENV['PATH'] = '/usr/bin:/bin'
+ yield
+ensure
+ ENV['PATH'] = old_path
+end
+
# Kernel.system but with exceptions
def safe_system cmd, *args
unless Homebrew.system cmd, *args