-
Notifications
You must be signed in to change notification settings - Fork 453
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
add support for terminal opcodes #210
base: master
Are you sure you want to change the base?
Conversation
Updates tailscale/tailscale#4146 Signed-off-by: Maisem Ali <[email protected]> Co-Authored-By: Ayman Bagabas <[email protected]>
I want to make sure I understand this right before merging it in, so I might not get to this right away. @bradfitz might also be a good person to weigh in. Also @maisem who implemented this in tailscale's ssh fork. Additionally, could we use this to replace the hard-coded \n to \r\n translation, using something like this block in the referenced PR? |
The emulation emulates Termios ONLCR mode which maps NL-CRNL (terminals 🙄). This would only matter if the modes are used with PTY allocation. In that case, the emulation might corrupt the terminal and we would have to disable it to make the allocated PTY work correctly. A possible solution is to be able to disable the emulation. Something like 4f6e0b5. Otherwise, and if breaking the API is an option, users can opt-in using a |
A breaking change would be completely reasonable for better PTY support. Realistically, for most people it wouldn't even matter because the existing behavior is less than ideal and is really just a hacky workaround. |
So more down the rabbit hole of SSH/PTY support. OpenSSH client sets the terminal into raw mode when the client requests a PTY session. 12 This sets the This means if you have this flag disabled before establishing an SSH session, the terminal wouldn't produce the right output because we always emulate the ONLCR flag. Instead, assuming we remove the emulation from the library, we should allocate a PTY and pass the SSH PTY request terminal modes to the allocated PTY to get the correct output (with ONLCR disabled). Footnotes |
Is working on better PTY support you'd be interested in, or not really? I realize that's a fairly big ask though, especially compared to what you're asking for in this PR. |
All credit goes to @maisem and Tailscale tailscale/tailscale#4154
Fixes: #98
Fixes: #131