From: Avery Pennarun Date: Tue, 8 Jun 2010 03:59:17 +0000 (-0400) Subject: cmd/newliner: if input starts getting too long, print it out. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=26a32bacfa97dcb2297f3c0723ef7507bcaf056a;p=packages%2Fb%2Fbup.git cmd/newliner: if input starts getting too long, print it out. 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 --- diff --git a/cmd/newliner-cmd.py b/cmd/newliner-cmd.py index 6c4e60f..6b505b4 100755 --- a/cmd/newliner-cmd.py +++ b/cmd/newliner-cmd.py @@ -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: