Grant Jenks <grant.je...@gmail.com> added the comment:

I asked on the ncurses maintainers email list about their logic and was pointed 
to tty_settings.c which checks:

1. stderr
2. stdout
3. stdin
4. open('/dev/tty', 'r+')

I don't know a cross-platform way to check #4 but I think #1-3 are a reasonable 
change to shutil.get_terminal_size().

The current logic checks only stdout. I'd like to amend that to try stderr, 
stdout, and stdin after checking the COLUMNS and LINES env vars. So the new 
logic would be:

1. Check COLUMNS and LINES env vars (for overrides)
2. Check os.get_terminal_size(stderr)
3. Check os.get_terminal_size(stdout)
4. Check os.get_terminal_size(stdin)

----------
nosy: +grantjenks
versions: +Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue14841>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to