Kaynağa Gözat

flush json mode progress stderr output

if borg stderr is not connected to a tty, but to ssh (when using
borg client/server), sys.stderr is block buffered (tty: line buffered).

thus we better flush explicitly after emitting a line as the receiving
side can not handle partial json at the end of the block.

also, it might solve some delays, when output didn't arrive at
receiving side in time.
Thomas Waldmann 7 yıl önce
ebeveyn
işleme
2b75b278da
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  1. 1 1
      src/borg/helpers/progress.py

+ 1 - 1
src/borg/helpers/progress.py

@@ -86,7 +86,7 @@ class ProgressIndicatorBase:
             finished=finished,
             time=time.time(),
         ))
-        print(json.dumps(kwargs), file=sys.stderr)
+        print(json.dumps(kwargs), file=sys.stderr, flush=True)
 
     def finish(self):
         if self.json: