diff options
| author | Markus Reiter | 2018-02-13 19:18:50 +0100 | 
|---|---|---|
| committer | GitHub | 2018-02-13 19:18:50 +0100 | 
| commit | 2a41f1359e81a52082f93c109beb3506bced2250 (patch) | |
| tree | cb176b35faee5e574f8cb637378df9fe6a29f53a | |
| parent | d309e50a32a048a1ca000125f6b5a3665db15ede (diff) | |
| parent | 102a2a491b12db20d5096418bb559e25c864f20a (diff) | |
| download | brew-2a41f1359e81a52082f93c109beb3506bced2250.tar.bz2 | |
Merge pull request #3803 from reitermarkus/cask-installer
Add Homebrew’s `bin` to PATH for Cask installers.
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/artifact/installer.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/system_command.rb | 11 | 
2 files changed, 5 insertions, 8 deletions
| diff --git a/Library/Homebrew/cask/lib/hbc/artifact/installer.rb b/Library/Homebrew/cask/lib/hbc/artifact/installer.rb index 5cd388c7f..8fa54c01e 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/installer.rb @@ -23,7 +23,7 @@ module Hbc          def install_phase(command: nil, **_)            ohai "Running #{self.class.dsl_key} script '#{path.relative_path_from(cask.staged_path)}'"            FileUtils.chmod "+x", path unless path.executable? -          command.run(path, **args) +          command.run(path, **args, path: PATH.new(HOMEBREW_PREFIX/"bin", HOMEBREW_PREFIX/"sbin", ENV["PATH"]))          end        end diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb index a890c42e4..dfb301999 100644 --- a/Library/Homebrew/cask/lib/hbc/system_command.rb +++ b/Library/Homebrew/cask/lib/hbc/system_command.rb @@ -37,7 +37,7 @@ module Hbc        result      end -    def initialize(executable, args: [], sudo: false, input: [], print_stdout: false, print_stderr: true, must_succeed: false, **options) +    def initialize(executable, args: [], sudo: false, input: [], print_stdout: false, print_stderr: true, must_succeed: false, path: ENV["PATH"], **options)        @executable = executable        @args = args        @sudo = sudo @@ -47,6 +47,7 @@ module Hbc        @must_succeed = must_succeed        options.extend(HashValidator).assert_valid_keys(:chdir)        @options = options +      @path = path      end      def command @@ -55,7 +56,7 @@ module Hbc      private -    attr_reader :executable, :args, :input, :options, :processed_output, :processed_status +    attr_reader :executable, :args, :input, :options, :processed_output, :processed_status, :path      attr_predicate :sudo?, :print_stdout?, :print_stderr?, :must_succeed? @@ -83,12 +84,8 @@ module Hbc      def each_output_line(&b)        executable, *args = expanded_command -      unless File.exist?(executable) -        executable = which(executable, PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin")) -      end -        raw_stdin, raw_stdout, raw_stderr, raw_wait_thr = -        Open3.popen3([executable, executable], *args, **options) +        Open3.popen3({ "PATH" => path }, executable, *args, **options)        write_input_to(raw_stdin)        raw_stdin.close_write | 
