Commit 35224764 authored by Daniel Kahn Gillmor's avatar Daniel Kahn Gillmor Committed by Chris Lamb

Correct spelling of ereser to eraser.

Signed-off-by: Chris Lamb's avatarChris Lamb <lamby@debian.org>
parent 8b90ec1a
......@@ -24,7 +24,7 @@ import logging
import importlib
import traceback
from ..logging import line_ereser
from ..logging import line_eraser
logger = logging.getLogger(__name__)
......@@ -134,7 +134,7 @@ class ComparatorManager(object):
))
for x in errors:
logger.error("Original error for %s:", x[0])
sys.stderr.buffer.write(line_ereser())
sys.stderr.buffer.write(line_eraser())
traceback.print_exception(None, x[1], x[1].__traceback__)
sys.exit(2)
......
......@@ -22,20 +22,20 @@ import contextlib
import logging
def line_ereser(fd=sys.stderr) -> bytes:
ereser = b'' # avoid None to avoid 'NoneType + str/bytes' failures
def line_eraser(fd=sys.stderr) -> bytes:
eraser = b'' # avoid None to avoid 'NoneType + str/bytes' failures
if fd.isatty():
from curses import tigetstr, setupterm
setupterm(fd=fd.fileno())
ereser = tigetstr('el')
eraser = tigetstr('el')
if not ereser and fd.isatty():
if not eraser and fd.isatty():
# is a tty, but doesn't support the proper scape code, so let's fake it
from shutil import get_terminal_size
width = get_terminal_size().columns
ereser = b'\r{}\r'.format(b' ' * width)
eraser = b'\r{}\r'.format(b' ' * width)
return ereser
return eraser
@contextlib.contextmanager
......@@ -49,7 +49,7 @@ def setup_logging(debug, log_handler):
logger.addHandler(ch)
formatter = logging.Formatter(
line_ereser().decode('ascii') +
line_eraser().decode('ascii') +
'%(asctime)s %(levelname).1s: %(name)s: %(message)s',
'%Y-%m-%d %H:%M:%S',
)
......
......@@ -33,7 +33,7 @@ from .path import set_path
from .tools import tool_prepend_prefix, tool_required, OS_NAMES, get_current_os
from .config import Config
from .locale import set_locale
from .logging import line_ereser, setup_logging
from .logging import line_eraser, setup_logging
from .progress import ProgressManager, Progress
from .profiling import ProfileManager, profile
from .tempfiles import clean_all_temp_files
......@@ -464,7 +464,7 @@ def main(args=None):
except BrokenPipeError:
sys.exit(2)
except Exception:
sys.stderr.buffer.write(line_ereser())
sys.stderr.buffer.write(line_eraser())
traceback.print_exc()
if parsed_args and parsed_args.debugger:
import pdb
......
......@@ -24,7 +24,7 @@ import json
import signal
import logging
from .logging import line_ereser
from .logging import line_eraser
logger = logging.getLogger(__name__)
......@@ -218,7 +218,7 @@ class ProgressBar(object):
kwargs.setdefault('fd', sys.stderr)
super().__init__(*args, **kwargs)
# Terminal handling after parent init since that sets self.fd
self.erase_to_eol = line_ereser(self.fd)
self.erase_to_eol = line_eraser(self.fd)
def _need_update(self):
return True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment