Revision 8915
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/util.sh | ||
---|---|---|
74 | 74 |
# `|| exit` needed on Mac because of bug where -e doesn't apply to () |
75 | 75 |
log_stderr () { if ! can_log; then exec 2>/dev/null; fi; } |
76 | 76 |
|
77 |
log_stderr_cmd () { (log_stderr; "$@") || exit; } # usage: log_stderr_cmd cmd... |
|
77 |
log_stderr_cmd () # usage: [stdout2stderr=1] log_stderr_cmd cmd... |
|
78 |
{ |
|
79 |
(log_stderr |
|
80 |
if test -n "$stdout2stderr"; then stdout2stderr; fi |
|
81 |
"$@" |
|
82 |
) || exit |
|
83 |
} |
|
78 | 84 |
|
79 | 85 |
echo_cmd () { if can_log; then echo "$PS4$*" >&2; fi; } |
80 | 86 |
|
Also available in: Unified diff
lib/util.sh: log_stderr_cmd (): support redirecting stdout to stderr *after*setting up the stderr redirect, so that stdout is also subject to that redirect