| ... | ... |
@@ -543,10 +543,11 @@ if [[ -n "$LOGFILE" ]]; then |
| 543 | 543 |
|
| 544 | 544 |
# Redirect output according to config |
| 545 | 545 |
|
| 546 |
- # Copy stdout to fd 3 |
|
| 546 |
+ # Set fd 3 to a copy of stdout. So we can set fd 1 without losing |
|
| 547 |
+ # stdout later. |
|
| 547 | 548 |
exec 3>&1 |
| 548 | 549 |
if [[ "$VERBOSE" == "True" ]]; then |
| 549 |
- # Redirect stdout/stderr to tee to write the log file |
|
| 550 |
+ # Set fd 1 and 2 to write the log file |
|
| 550 | 551 |
exec 1> >( awk -v logfile=${LOGFILE} '
|
| 551 | 552 |
/((set \+o$)|xtrace)/ { next }
|
| 552 | 553 |
{
|
| ... | ... |
@@ -559,7 +560,7 @@ if [[ -n "$LOGFILE" ]]; then |
| 559 | 559 |
|
| 560 | 560 |
fflush("")
|
| 561 | 561 |
}' ) 2>&1 |
| 562 |
- # Set up a second fd for output |
|
| 562 |
+ # Set fd 6 to summary log file |
|
| 563 | 563 |
exec 6> >( tee "${SUMFILE}" )
|
| 564 | 564 |
else |
| 565 | 565 |
# Set fd 1 and 2 to primary logfile |
| ... | ... |
@@ -574,7 +575,8 @@ if [[ -n "$LOGFILE" ]]; then |
| 574 | 574 |
ln -sf $SUMFILE $LOGDIR/$LOGFILENAME.summary |
| 575 | 575 |
else |
| 576 | 576 |
# Set up output redirection without log files |
| 577 |
- # Copy stdout to fd 3 |
|
| 577 |
+ # Set fd 3 to a copy of stdout. So we can set fd 1 without losing |
|
| 578 |
+ # stdout later. |
|
| 578 | 579 |
exec 3>&1 |
| 579 | 580 |
if [[ "$VERBOSE" != "True" ]]; then |
| 580 | 581 |
# Throw away stdout and stderr |