]> arthur.barton.de Git - bup.git/commitdiff
cmd/newliner: if input starts getting too long, print it out.
authorAvery Pennarun <apenwarr@gmail.com>
Tue, 8 Jun 2010 03:59:17 +0000 (23:59 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Tue, 8 Jun 2010 04:00:28 +0000 (00:00 -0400)
This prevents output that doesn't have any newlines from being buffered
forever (eg. the output of 'bup split -vv').

Reported by Karl Kiniger.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
cmd/newliner-cmd.py

index 6c4e60f336e7c0ce76f47f8a0334a5daec48b517..6b505b4a992b97d913cb1679ba11b99a0a4f9065 100755 (executable)
@@ -17,6 +17,10 @@ all = ''
 while 1:
     l = r.split(all, 1)
     if len(l) <= 1:
+        if len(all) >= 160:
+            sys.stdout.write('%s\n' % all[:78])
+            sys.stdout.flush()
+            all = all[78:]
         try:
             b = os.read(sys.stdin.fileno(), 4096)
         except KeyboardInterrupt: