do no longer use the ncurses module in the dump subparser
it seems to cause issues when trying to redirect the output of the
subparser on windows. Since was only used to determine the width of
the terminal anyway, let's determine that using
`os.get_terminal_size()`.
import argparse
+import os
from . import formatting
from ... import database
@@ -105,15 +106,8 @@ def _dump_can_message(message, with_comments=False, name_prefix='', WIDTH=None):
def _dump_can_database(dbase, with_comments=False):
WIDTH = 80
try:
- import curses
- except ModuleNotFoundError: # pragma: no cover
- pass
- else:
- try:
- _stdscr = curses.initscr()
- _, WIDTH = _stdscr.getmaxyx() # pragma: no cover
- curses.endwin() # pragma: no cover
- except Exception as e:
+ WIDTH, _ = os.get_terminal_size()
+ except:
pass
print('================================= Messages =================================')
