aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/ENV/shared.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb
index 3b07e0a71..2cdc2f83a 100644
--- a/Library/Homebrew/extend/ENV/shared.rb
+++ b/Library/Homebrew/extend/ENV/shared.rb
@@ -87,7 +87,11 @@ module SharedEnvExtension
# Is the formula struggling to find the pkgconfig file? Point it to it.
# This is done automatically for `keg_only` formulae.
# <pre>ENV.prepend_path "PKG_CONFIG_PATH", "#{Formula["glib"].opt_lib}/pkgconfig"</pre>
+ # Prepending a system path such as /usr/bin is a no-op so that requirements
+ # don't accidentally override superenv shims or formulae's `bin` directories
+ # (e.g. <pre>ENV.prepend_path "PATH", which("emacs").dirname</pre>)
def prepend_path(key, path)
+ return if %w[/usr/bin /bin /usr/sbin /sbin].include? path.to_s
prepend key, path, File::PATH_SEPARATOR if File.directory? path
end