From: Simon Persson Date: Sun, 11 May 2014 09:06:34 +0000 (+0800) Subject: Always line-buffer bup restore stdout X-Git-Tag: 0.26-rc1~2 X-Git-Url: https://arthur.barton.de/gitweb/?p=bup.git;a=commitdiff_plain;h=926f2a9e630dbd355f91c77de65831bfce8014a2 Always line-buffer bup restore stdout Flush stdout after every line, even when stdio is not a tty, to provide more regular progress information. Useful for progress monitoring by a parent process or when watching a logfile with "tail". Signed-off-by: Simon Persson [rlb@defaultvalue.org: adjust commit message] Signed-off-by: Rob Browning --- diff --git a/cmd/restore-cmd.py b/cmd/restore-cmd.py index d1dc1cf..535d83c 100755 --- a/cmd/restore-cmd.py +++ b/cmd/restore-cmd.py @@ -20,6 +20,9 @@ q,quiet don't show progress meter total_restored = 0 +# stdout should be flushed after each line, even when not connected to a tty +sys.stdout.flush() +sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 1) def verbose1(s): if opt.verbose >= 1: