Revision 9225
Added by Aaron Marcuse-Kubitza almost 12 years ago
lib/sh/util.sh | ||
---|---|---|
228 | 228 |
cmd2rel_path; (echo_params; can_log) && indent || true |
229 | 229 |
( |
230 | 230 |
# the following redirections must happen in exactly this order |
231 |
if ! (log++; can_log); then disable_logging; fi |
|
232 |
if test "$cmd_log_fd"; then echo_eval exec "$cmd_log_fd>&$log_fd"; fi |
|
231 |
if test "$cmd_log_fd"; then |
|
232 |
echo_eval exec "$cmd_log_fd>$(if (log++; can_log); then \ |
|
233 |
echo "&$log_fd"; else echo /dev/null; fi)" |
|
234 |
fi |
|
233 | 235 |
if test "$cmd_log_fd" != 2; then # fd 2 not used for logging |
234 | 236 |
exec 2>&"$err_fd" # assume fd 2 used for errors |
235 | 237 |
fi |
Also available in: Unified diff
bugfix: lib/sh/util.sh: command(): limit cmd_log_fd directly instead of limiting log_fd (usually fd 2) and then redirecting cmd_log_fd to it. this ensures that stderr is not limited unless it's actually used as the cmd_log_fd, so that a non-logging stderr will still reach the user properly regardless of whether err_fd is set to something other than 2. (previously, without an err_fd at 22, closing fd 2 at the beginning of the set of redirections would leave no fd pointing to a place to echo errors to.)