diff options
| author | Shaun Jackman | 2017-12-01 15:00:27 -0800 |
|---|---|---|
| committer | Shaun Jackman | 2017-12-02 15:52:01 -0800 |
| commit | 7adee6d62fabae0244d611069f09ab906a459805 (patch) | |
| tree | d9315fecb1abf11b9af470cfd31bff8b5a28a211 /Library/Homebrew/utils | |
| parent | dfe0a1eb898dcee72dc113737c79bff588383130 (diff) | |
| download | brew-7adee6d62fabae0244d611069f09ab906a459805.tar.bz2 | |
Utils.popen_read: Nonexistent program should fail
Ensure that $CHILD_STATUS.success? is false when the command does not exist.
Diffstat (limited to 'Library/Homebrew/utils')
| -rw-r--r-- | Library/Homebrew/utils/popen.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Library/Homebrew/utils/popen.rb b/Library/Homebrew/utils/popen.rb index 2fa3ade46..21dceec06 100644 --- a/Library/Homebrew/utils/popen.rb +++ b/Library/Homebrew/utils/popen.rb @@ -14,7 +14,15 @@ module Utils yield pipe else options[:err] ||= :close unless ENV["HOMEBREW_STDERR"] - exec(*args, options) + begin + exec(*args, options) + rescue Errno::ENOENT + $stderr.puts "brew: command not found: #{args[0]}" unless options[:err] == :close + exit! 127 + rescue SystemCallError + $stderr.puts "brew: exec failed: #{args[0]}" unless options[:err] == :close + exit! 1 + end end end end |
