From 9446ec7f469e302e4aa4f07fbc787de6910888c6 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 26 Mar 2017 17:16:42 -0400 Subject: [PATCH] Flush the stdout buffer after printing a line Pointed out in #2490, this is a regression introduced by #2398. We need to flush the buffer to faithfully emulate the "real" print() function. --- beets/ui/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index df370b52e..29e228497 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -148,6 +148,7 @@ def print_(*strings, **kwargs): if hasattr(sys.stdout, 'buffer'): out = txt.encode(_out_encoding(), 'replace') sys.stdout.buffer.write(out) + sys.stdout.buffer.flush() else: # In our test harnesses (e.g., DummyOut), sys.stdout.buffer # does not exist. We instead just record the text string.