Skip to content
Snippets Groups Projects
Commit 038ac847 authored by Daniel Kahn Gillmor's avatar Daniel Kahn Gillmor Committed by Chris Lamb
Browse files

Avoid line eraser error on dumb terminals. (Closes: #906967)


Try the following:

    touch a b
    TERM=dumb diffoscope a b

The result is some nasty warnings about:

    AttributeError: 'bytes' object has no attribute 'format'

This patch fixes the problem.

Signed-off-by: Chris Lamb's avatarChris Lamb <lamby@debian.org>
parent 35224764
No related branches found
No related tags found
No related merge requests found
Pipeline #17318 failed
......@@ -30,10 +30,10 @@ def line_eraser(fd=sys.stderr) -> bytes:
eraser = tigetstr('el')
if not eraser and fd.isatty():
# is a tty, but doesn't support the proper scape code, so let's fake it
# is a tty, but doesn't support the proper escape code, so let's fake it
from shutil import get_terminal_size
width = get_terminal_size().columns
eraser = b'\r{}\r'.format(b' ' * width)
eraser = b'\r' + (b' ' * width) + b'\r'
return eraser
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment