]> git.scottworley.com Git - pinch/commitdiff
Handle 0 terminal width
authorScott Worley <scottworley@scottworley.com>
Thu, 11 Jun 2020 20:29:20 +0000 (13:29 -0700)
committerScott Worley <scottworley@scottworley.com>
Thu, 11 Jun 2020 20:29:20 +0000 (13:29 -0700)
pinch.py

index 24e132aad745caa820c05d34461b8523fc83ec32..5d93c262cf192d5ee04e3755da3e50f76b15a997 100644 (file)
--- 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