mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
calibredb list: Fix incorrect output when redirecting to file
py3 compat, caused by mix of text and binary output streams.
This commit is contained in:
parent
bd9f294318
commit
78a001b335
@ -8,7 +8,6 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
from textwrap import TextWrapper
|
from textwrap import TextWrapper
|
||||||
|
|
||||||
from calibre import prints
|
|
||||||
from calibre.db.cli.utils import str_width
|
from calibre.db.cli.utils import str_width
|
||||||
from calibre.ebooks.metadata import authors_to_string
|
from calibre.ebooks.metadata import authors_to_string
|
||||||
from calibre.utils.date import isoformat
|
from calibre.utils.date import isoformat
|
||||||
@ -201,7 +200,7 @@ def do_list(
|
|||||||
fields
|
fields
|
||||||
)
|
)
|
||||||
with ColoredStream(sys.stdout, fg='green'):
|
with ColoredStream(sys.stdout, fg='green'):
|
||||||
prints(''.join(titles))
|
print(''.join(titles), flush=True)
|
||||||
stdout = getattr(sys.stdout, 'buffer', sys.stdout)
|
stdout = getattr(sys.stdout, 'buffer', sys.stdout)
|
||||||
linesep = as_bytes(os.linesep)
|
linesep = as_bytes(os.linesep)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user