Revision 9292
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/util.sh | ||
---|---|---|
425 | 425 |
cmd2rel_path; (echo_params; can_log) && indent || true |
426 | 426 |
( |
427 | 427 |
# the following redirections must happen in exactly this order |
428 |
if test "$cmd_log_fd"; then |
|
429 |
set_fds "$cmd_log_fd>$(if (log++; can_log); then \ |
|
430 |
echo "&$log_fd"; else echo /dev/null; fi)" |
|
431 |
fi |
|
428 |
if test "$cmd_log_fd"; then command__set_fds; fi |
|
432 | 429 |
if test "$cmd_log_fd" != 2; then # fd 2 not used for logging |
433 | 430 |
exec 2>&"$err_fd" # assume fd 2 used for errors |
434 | 431 |
fi |
... | ... | |
436 | 433 |
exec -- "$@" # -- so cmd name not treated as `exec` option |
437 | 434 |
) || return |
438 | 435 |
} |
436 |
function command__set_fds() |
|
437 |
{ |
|
438 |
ensure_nested_func |
|
439 |
if test "$cmd_log_fd" = "$log_fd"; then log++; log++; fi # default case |
|
440 |
set_fds "$cmd_log_fd>$(if (log++; can_log); then \ |
|
441 |
echo "&$log_fd"; else echo /dev/null; fi)" |
|
442 |
} |
|
439 | 443 |
|
440 | 444 |
# auto-echo common external commands |
441 | 445 |
for cmd in env rm; do alias "$cmd=command $cmd"; done; unset cmd |
Also available in: Unified diff
lib/sh/util.sh: command(): if cmd_log_fd = log_fd, log the filtering of cmd_log_fd at 2 log_levels higher (verbosity >= 3)