-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Determine the terminal size in a subshell (unix) #276
Comments
I know that the This approach is pragmatic and I'm fine with it. Although, do we know how the |
Invoking a separate program has many problems, not least of which that it won't work if the program runs in a container or chroot.
|
@joshtriplett I agree that invoking a separate program is problematic (should we use it in a separate function?) but you can easily check in a subshell that this solution works while the I'd be happy to use a better solution, using tput is a workaround. Can you investigate and determine why tput works in subshells while the current solution in use in crossterm and similar libs doesn't ? |
Just a thought here ... This is what we do for cursor ... Lines 67 to 71 in 3ab5b17
crossterm/src/cursor/sys/unix.rs Lines 29 to 43 in 3ab5b17
crossterm/src/input/sys/unix.rs Lines 578 to 594 in 3ab5b17
There's |
This issue is fixed with #283, if not, re-open. |
What do you mean by "in a subshell" here? I have checked that running tput in a subshell still correctly figures out the terminal size. tput just tries stderr, stdout, and stdin, to see if they're hooked up to the terminal, and if not then it opens |
@joshtriplett Write a Then call it as
Then What tput does could probably be reproduced, and I'm all for doing it, but in the meantime calling it is a working workaround. |
This commit also adds support for borrowed deserialization (crossterm-rs#231, RUST-688) and fixes RUST-880 and RUST-884.
Like all other libraries I've checked, crossterm fails to read the terminal size when the crossterm based program is ran in a subshell.
I've found a solution which works in my tests: call
tput cols
andtput lines
and parse the result:I'm willing to post a PR.
Check-list before the PR:
(In the meantime I've included the function in termimad which will let me run more tests)
The text was updated successfully, but these errors were encountered: