Skip to content

Commit 3ccfa06

Browse files
committed
added auto-flusing for wrapped streams. fixes wolph#160 and fixes wolph#159
1 parent 2603b1e commit 3ccfa06

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

progressbar/bar.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def finish(self, *args, **kwargs): # pragma: no cover
7777

7878
if end:
7979
self.fd.write(end)
80+
8081
self.fd.flush()
8182

8283

progressbar/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ def __init__(self, target, capturing=False, listeners=set()):
2828
def write(self, value):
2929
if self.capturing:
3030
self.buffer.write(value)
31-
for listener in self.listeners: # pragma: no branch
32-
listener.update()
31+
if '\n' in value:
32+
for listener in self.listeners: # pragma: no branch
33+
listener.update()
3334
else:
3435
self.target.write(value)
3536

0 commit comments

Comments
 (0)