Browse code

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

Sean Dague authored on 2014/03/16 02:50:36
Showing 1 changed files
... ...
@@ -538,10 +538,10 @@ if [[ -n "$LOGFILE" ]]; then
538 538
                     cmd | getline now
539 539
                     close("date +\"%Y-%m-%d %H:%M:%S.%3N | \"")
540 540
                     sub(/^/, now)
541
-                    print
542 541
                     print > logfile
543
-                    fflush("")
544 542
                     fflush(logfile)
543
+                    print
544
+                    fflush("")
545 545
                 }' ) 2>&1
546 546
         # Set up a second fd for output
547 547
         exec 6> >( tee "${SUMFILE}" )