Skip to content

Commit

Permalink
Fix broken pipe warning
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsaunders committed Nov 26, 2013
1 parent 5e7622b commit 919e170
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion exercise.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ for d in ${TESTS}; do
fi

source ${d}
if $(set | grep -q 'setup ()'); then

# don't use grep -q as it causes grep to quit after the first match and
# send SIGPIPE to the source. The source is bash (set builtin) which
# doesn't handle the signal properly.
if $(set | grep 'setup ()' &>/dev/null); then
# not in a subshell, so globals can be modified
FAIL_REASON="Setup function failed"
echo "======== TEST SETUP FOR ${d} =========" > ${TMPDIR}/test.txt
Expand Down

0 comments on commit 919e170

Please sign in to comment.