Remove with_system_path

The method with_system_path is no longer needed,
since environment filtering uses a default PATH.
This commit is contained in:
Shaun Jackman 2017-12-12 09:27:06 -08:00
parent a4033c7196
commit ce85e3b3b5
2 changed files with 9 additions and 17 deletions

View File

@ -217,12 +217,12 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
def stage def stage
case type = cached_location.compression_type case type = cached_location.compression_type
when :zip when :zip
with_system_path { quiet_safe_system "unzip", "-qq", cached_location } quiet_safe_system "unzip", "-qq", cached_location
chdir chdir
when :gzip_only when :gzip_only
with_system_path { buffered_write("gunzip") } buffered_write "gunzip"
when :bzip2_only when :bzip2_only
with_system_path { buffered_write("bunzip2") } buffered_write "bunzip2"
when :gzip, :bzip2, :xz, :compress, :tar when :gzip, :bzip2, :xz, :compress, :tar
tar_flags = "x" tar_flags = "x"
if type == :gzip if type == :gzip
@ -233,16 +233,14 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
tar_flags << "J" tar_flags << "J"
end end
tar_flags << "f" tar_flags << "f"
with_system_path do if type == :xz && DependencyCollector.tar_needs_xz_dependency?
if type == :xz && DependencyCollector.tar_needs_xz_dependency? pipe_to_tar xzpath
pipe_to_tar(xzpath) else
else safe_system "tar", tar_flags, cached_location
safe_system "tar", tar_flags, cached_location
end
end end
chdir chdir
when :lzip when :lzip
with_system_path { pipe_to_tar(lzippath) } pipe_to_tar lzippath
chdir chdir
when :lha when :lha
safe_system lhapath, "x", cached_location safe_system lhapath, "x", cached_location

View File

@ -267,12 +267,6 @@ module Homebrew
# rubocop:enable Style/GlobalVars # rubocop:enable Style/GlobalVars
end end
def with_system_path
with_env(PATH: PATH.new("/usr/bin", "/bin")) do
yield
end
end
def with_homebrew_path def with_homebrew_path
with_env(PATH: PATH.new(ENV["HOMEBREW_PATH"])) do with_env(PATH: PATH.new(ENV["HOMEBREW_PATH"])) do
yield yield
@ -376,7 +370,7 @@ end
# GZips the given paths, and returns the gzipped paths # GZips the given paths, and returns the gzipped paths
def gzip(*paths) def gzip(*paths)
paths.collect do |path| paths.collect do |path|
with_system_path { safe_system "gzip", path } safe_system "gzip", path
Pathname.new("#{path}.gz") Pathname.new("#{path}.gz")
end end
end end