change the order of the print/flush

It seems that we get a different behavior whether stdout is closed
in the parent process or not when it comes to buffering. If it's
closed we don't get the last line flushed out to the file, if it's
not closed we do. This was seen in the trove pg fail.

A complete shot in the dark, but I'd like to see if this is fixed
with being explicit with printing to the log before stdout.

Change-Id: Ie37299dbc88d549d34d85731e571a5b7ef181311
This commit is contained in:
Sean Dague 2014-03-15 13:50:36 -04:00
parent f10d8feca0
commit 7afffa6447

View File

@ -538,10 +538,10 @@ if [[ -n "$LOGFILE" ]]; then
cmd | getline now
close("date +\"%Y-%m-%d %H:%M:%S.%3N | \"")
sub(/^/, now)
print
print > logfile
fflush("")
fflush(logfile)
print
fflush("")
}' ) 2>&1
# Set up a second fd for output
exec 6> >( tee "${SUMFILE}" )