Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.

Get size from controlling terminal? #34

Open
swsnr opened this issue Oct 16, 2020 · 1 comment
Open

Get size from controlling terminal? #34

swsnr opened this issue Oct 16, 2020 · 1 comment

Comments

@swsnr
Copy link

swsnr commented Oct 16, 2020

Currently term_size queries the standard streams to get the terminal size which fails if all are redirected.

However POSIX also provides means to directly get hold of the underlying terminal even if all streams are redirected, via ctermid. This function returns the path to the terminal device which we can then open() to get a file description for ioctl. While man 3 ctermid warns that open may fail, practically it never does, whereas redirection is somewhat common.

Would you mind to add a function which gets the terminal size from the controlling terminal?

@CreepySkeleton
Copy link
Contributor

Sounds good to me, but the future of this crate is somewhat cloudy.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants