Problem
hubfly ssh currently behaves like a raw terminal passthrough.
When a user types exit, that exits the shell running inside the container. What we also need is a way to leave the local hubfly ssh session itself and get back to the user's normal terminal workflow without treating that as a command to the container shell.
This matters because users may want to disconnect from the CLI session while leaving the container process state alone, or simply recover from an attached session without sending shell-exit semantics into the container.
Requested behavior
Add a local detach/exit mechanism for interactive hubfly ssh sessions.
Desired outcome:
- User can leave the
hubfly ssh session and return to their local shell.
- This action should close the local websocket/terminal session.
- It should not send
exit to the container shell.
- It should not require terminating the container or changing container state.
Example UX
A local escape sequence is the safest direction, for example:
Ctrl+]
- or
~. style handling similar to OpenSSH
- or another explicit local-only detach shortcut
Typing plain exit should remain container-shell behavior.
Suggested implementation direction
The likely fix is in the CLI terminal client path:
- Detect a local escape sequence inside
pumpStdin() / interactive terminal handling.
- When that sequence is seen:
- stop forwarding further input to the container,
- close the websocket cleanly,
- restore the local terminal state,
- return control to the local shell,
- avoid injecting
exit, Ctrl-D, or other shell-closing bytes into the remote container.
Potential files involved:
A reasonable approach is:
- reserve a local-only escape sequence,
- parse it before sending stdin bytes upstream,
- trigger local shutdown from the CLI side,
- keep remote shell semantics unchanged for ordinary input like
exit.
Notes
A non-interactive path already exists via:
hubfly ssh <container> -- <cmd>
This issue is specifically about the interactive attached shell mode.
Problem
hubfly sshcurrently behaves like a raw terminal passthrough.When a user types
exit, that exits the shell running inside the container. What we also need is a way to leave the localhubfly sshsession itself and get back to the user's normal terminal workflow without treating that as a command to the container shell.This matters because users may want to disconnect from the CLI session while leaving the container process state alone, or simply recover from an attached session without sending shell-exit semantics into the container.
Requested behavior
Add a local detach/exit mechanism for interactive
hubfly sshsessions.Desired outcome:
hubfly sshsession and return to their local shell.exitto the container shell.Example UX
A local escape sequence is the safest direction, for example:
Ctrl+]~.style handling similar to OpenSSHTyping plain
exitshould remain container-shell behavior.Suggested implementation direction
The likely fix is in the CLI terminal client path:
pumpStdin()/ interactive terminal handling.exit,Ctrl-D, or other shell-closing bytes into the remote container.Potential files involved:
internal/cli/shell.goA reasonable approach is:
exit.Notes
A non-interactive path already exists via:
This issue is specifically about the interactive attached shell mode.