From 7afffa6447c83352b95ff91968ab2dc9ad64d38c Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Sat, 15 Mar 2014 13:50:36 -0400 Subject: [PATCH] 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 --- stack.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stack.sh b/stack.sh index 09e9eec803..7fa4d37b07 100755 --- a/stack.sh +++ b/stack.sh @@ -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}" )