Skip to content

Commit bf365e1

Browse files
native-apiskvark
authored andcommitted
Fix "Error: broken pipe" if brew info gives lots of output
1 parent ea088a9 commit bf365e1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

travis_osx_brew_cache.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,9 @@ function _brew_is_bottle_available {
307307
local PACKAGE;PACKAGE="${1:?}"
308308
local VAR_KEG_ONLY="$2"
309309

310-
local INFO;INFO="$(brew info "$PACKAGE" | head -n 1)"
310+
# `brew info` prints "Error: Broken pipe" if piped directly to `head` and the info is long
311+
# 141 = 128 + SIGPIPE
312+
local INFO;INFO="$((brew info "$PACKAGE" | cat || test $? -eq 141) | head -n 1)"
311313
if [ -n "$VAR_KEG_ONLY" ]; then
312314
if grep -qwF '[keg-only]' <<<"$INFO"; then
313315
eval "${VAR_KEG_ONLY}=1"

0 commit comments

Comments
 (0)