Skip to content

Commit

Permalink
calibredb list: Fix incorrect output when redirecting to file
Browse files Browse the repository at this point in the history
py3 compat, caused by mix of text and binary output streams.
  • Loading branch information
kovidgoyal committed Jan 9, 2021
1 parent bd9f294 commit 78a001b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/calibre/db/cli/cmd_list.py
Expand Up @@ -8,7 +8,6 @@
import sys
from textwrap import TextWrapper

from calibre import prints
from calibre.db.cli.utils import str_width
from calibre.ebooks.metadata import authors_to_string
from calibre.utils.date import isoformat
Expand Down Expand Up @@ -201,7 +200,7 @@ def do_list(
fields
)
with ColoredStream(sys.stdout, fg='green'):
prints(''.join(titles))
print(''.join(titles), flush=True)
stdout = getattr(sys.stdout, 'buffer', sys.stdout)
linesep = as_bytes(os.linesep)

Expand Down

0 comments on commit 78a001b

Please sign in to comment.