Revision 9200
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/util.sh | ||
---|---|---|
197 | 197 |
|
198 | 198 |
### command verbose output |
199 | 199 |
|
200 |
# usage: ([stdout2stderr=1] limit_stderr; cmd...) || return
|
|
200 |
# usage: (limit_stderr; cmd...) || return |
|
201 | 201 |
# `|| return` needed on Mac because of bug where -e doesn't apply to () |
202 | 202 |
function limit_stderr() |
203 | 203 |
{ |
204 | 204 |
log++ # should only apply during this function for use by can_log |
205 | 205 |
if ! can_log; then exec 2>/dev/null; fi |
206 |
if test "$stdout2stderr"; then stdout2stderr; fi |
|
207 | 206 |
} |
208 | 207 |
|
209 | 208 |
|
... | ... | |
238 | 237 |
|
239 | 238 |
cmd2rel_path; echo_cmd "$@"; indent |
240 | 239 |
( |
240 |
# the following redirections must happen in exactly this order |
|
241 | 241 |
if test "$limit_stderr"; then limit_stderr; fi |
242 |
if test "$stdout2stderr"; then stdout2stderr; fi |
|
242 | 243 |
if test "$stderr_is_errors"; then exec 2>&22; fi # ensure errors visible |
244 |
|
|
243 | 245 |
builtin command -- "$@" # -- so cmd name not treated as `command` option |
244 | 246 |
) || return |
245 | 247 |
} |
Also available in: Unified diff
lib/sh/util.sh: limit_stderr(): moved $stdout2stderr to command() so that limit_stderr()'s only purpose is to log-limit stderr