Skip to content
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

Try to unbreak the terminal size when working nested #255

Merged
merged 2 commits into from
Sep 10, 2019

Conversation

debarshiray
Copy link
Member

When running nested, stty(1) is invoked against the inner
pseudo-terminal pair created by 'podman exec --tty' which may not have
a valid size due to: containers/podman#3946

In such cases, the COLUMNS and LINES variables set by toolbox(1) in the
outer environment should be forwarded.

This should have been part of commit 05544fb.

https://github.com/debarshiray/toolbox/issues/242

@debarshiray
Copy link
Member Author

@tagoh what do you think about this?

@tagoh
Copy link
Contributor

tagoh commented Sep 10, 2019

LGTM

As noted, COLUMNS and LINES aren't the exported variables though, it is always synced up when the terminal window size is changed. so the above approach should works as expected on nested.

It was working because the environment_options variable gets reset
soon afterwards.

Fallout from 05544fb

https://github.com/debarshiray/toolbox/issues/242
When running nested, stty(1) is invoked against the inner
pseudo-terminal pair created by 'podman exec --tty' which may not have
a valid size due to: containers/podman#3946

In such cases, the COLUMNS and LINES variables set by toolbox(1) in the
outer environment should be forwarded.

This should have been part of commit 05544fb.

https://github.com/debarshiray/toolbox/issues/242
@debarshiray debarshiray force-pushed the wip/rishi/inherit-terminal-size-2 branch from c517a3a to 341541a Compare September 10, 2019 10:57
@debarshiray
Copy link
Member Author

As noted, COLUMNS and LINES aren't the exported variables though,
it is always synced up when the terminal window size is changed. so the
above approach should works as expected on nested.

The issue is that podman exec --tty creates a second pseudo-terminal pair that's nested inside the original pseudo-terminal created by the terminal emulator (eg., GNOME Terminal). This inner PTY is the one that doesn't have a valid size. So we run stty(1) before podman exec --tty to get the size, and then forward it via the variables.

When we invoke toolbox(1) from inside a container (ie., a podman exec --tty session), stty(1) gets run against the inner PTY pair, which might not have a valid size if the terminal window wasn't resized. In that case, the stty(1) output will be invalid, and our only hope is to forward the variables.

@debarshiray debarshiray merged commit 341541a into master Sep 10, 2019
@debarshiray debarshiray deleted the wip/rishi/inherit-terminal-size-2 branch September 10, 2019 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants