[issue14841] os.get_terminal_size() should check stdin as a fallback

Denilson Figueiredo de Sá report at bugs.python.org
Tue Jul 8 00:10:50 CEST 2014


Denilson Figueiredo de Sá added the comment:

FYI, "tput" tool can find out the dimensions even when both stdin and stdout are redirected. It can't, however, if all stdin, stdout and stderr are redirected. Python should probably implement a similar logic.

$ echo | stty size
stty: standard input: Inappropriate ioctl for device
$ echo | tput cols | cat
223
$ echo | tput cols 2>&1 | cat 
80

(tested under Linux)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14841>
_______________________________________


More information about the Python-bugs-list mailing list