Brian Silverman | 8dd8a05 | 2018-09-02 17:08:31 -0700 | [diff] [blame] | 1 | #!/bin/bash |
2 | |||||
3 | # This program hides all the output on stderr from the called command, unless it | ||||
4 | # fails, in which case all the output is printed at the end. | ||||
5 | |||||
6 | set -e | ||||
7 | set -u | ||||
8 | |||||
9 | readonly STDERR_FILE="$(mktemp)" | ||||
10 | |||||
11 | if ! "$@" 2>"${STDERR_FILE}" ; then | ||||
12 | cat "${STDERR_FILE}" | ||||
13 | exit 1 | ||||
14 | fi |