Best way of finding terminal width/height?

Joel Hedlund joel.hedlund at gmail.com
Thu Feb 9 03:08:13 EST 2006


> It didn't insert an EOF, it just caused read() to return
> "prematurely".  You should call read() again until it receives
> a _real_ EOF and returns ''.

Copy that. Point taken.

> There appear to be a couple problems with this description:
>
>  1) It says that read() in blocking mode without a size
>     parameter it will read until EOF.  This is not what happens
>     when reading a terminal that receives SIGWINCH, so you're
>     right: read() it isn't working as described.
>
>  2) It also says that it makes sense to continue to read a tty
>     after you get an EOF.  That's not true.  Once you get an
>     EOF on a tty, there's no point in reading it any more:
>     you'll continue to get an EOF forever.

Should I post a bug about this?

/Joel



More information about the Python-list mailing list