Is shutil.get_terminal_size useless?

Marko Rauhamaa marko at
Sat Jan 28 16:26:33 EST 2017

Chris Angelico <rosuav at>:

> On Sun, Jan 29, 2017 at 7:04 AM, eryk sun <eryksun at> wrote:
>> Now let's get rid of the terminal via setsid:
>>    $ echo spam |
>>     > 2>&1 setsid python3 -c 'import os
>>     > fd ="/dev/tty", os.O_RDONLY)
>>     > print(os.get_terminal_size(fd))' |
>>     > cat
>>     Traceback (most recent call last):
>>       File "<string>", line 2, in <module>
>>     OSError: [Errno 6] No such device or address: '/dev/tty'
> And you could have achieved the same result in any number of other
> ways, too, like setting yourself up with the local boot system (true
> of systemd, upstart, sysvinit, and probably of all others too), or
> cron, or inetd, etc, etc, etc. You can definitely lose access to your
> "controlling terminal".

Eryk has a real, deeper point worth getting acquainted with.

(Although if I were to design an operating system, I don't know if I
would bother with controlling terminals, job control or chirping


More information about the Python-list mailing list