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

Question - how to leave the connection open without a tty #171

Closed
chazsconi opened this issue Feb 9, 2022 · 4 comments
Closed

Question - how to leave the connection open without a tty #171

chazsconi opened this issue Feb 9, 2022 · 4 comments

Comments

@chazsconi
Copy link

I'm trying to create a installable binary that supports the -T option (no tty) so I can use it to connect to with VSCode's remote option.

VSCode fails to connect with a Failed to parse remote port from server output error - I'm not certain, but I expect this is because it sends the -T option, but then the ssh server immediately closes the connection because there is no command or tty.

What code do I need to leave the connection open without having a tty?

@CaffreyZhang
Copy link

Hi, I have the same problem.
Did you solve it?

@chazsconi
Copy link
Author

Hi @ZhangKingsasa. In the end we used https://github.com/openssh/openssh-portable instead for our use case.

@mohammed90
Copy link

mohammed90 commented Jul 12, 2022

You can get that information from the session. Here's a hint from the example:

ssh.Handle(func(sess ssh.Session) {
_, _, isTty := sess.Pty()
cfg := &container.Config{
Image: sess.User(),
Cmd: sess.Command(),
Env: sess.Environ(),
Tty: isTty,
OpenStdin: true,
AttachStderr: true,
AttachStdin: true,
AttachStdout: true,
StdinOnce: true,
Volumes: make(map[string]struct{}),
}

@gustavosbarreto
Copy link
Collaborator

Hi @ZhangKingsasa. In the end we used https://github.com/openssh/openssh-portable instead for our use case.

@ZhangKingsasa Could you please close this issue?

@belak belak closed this as completed Aug 25, 2022
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

No branches or pull requests

5 participants