From dd1026fe9c1e4b3b4097d5a9589597b64ca0b55b Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 11 Jun 2020 13:29:20 -0700 Subject: [PATCH 1/1] Handle 0 terminal width --- pinch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pinch.py b/pinch.py index 24e132a..5d93c26 100644 --- a/pinch.py +++ b/pinch.py @@ -83,7 +83,7 @@ class Verification: def result(self, r: bool) -> None: message, color = {True: ('OK ', 92), False: ('FAIL', 91)}[r] length = len(message) - cols = shutil.get_terminal_size().columns + cols = shutil.get_terminal_size().columns or 80 pad = (cols - (self.line_length + length)) % cols print(' ' * pad + self._color(message, color), file=sys.stderr) self.line_length = 0 -- 2.44.1