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

When reusing an existing client, don't detach when ssh finishes #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jyn514
Copy link

@jyn514 jyn514 commented Apr 2, 2025

Previously, when running tmux-cssh from an existing session, it would reuse the current client. This is reasonable; nesting tmux sessions is generally not a good idea. However, when the ssh commands finished, the session would be destroyed, and the client would automatically detach, closing the terminal. That makes it hard to understand what happened, especially when running non-interactive commands with -o RemoteCommand.

Tell tmux not to detach in this case. set-option is automatically scoped to the target session, so this does not affect other sessions.

Use no-detached, not on or attach-client -f no-detach-on-destroy, because there may be another terminal open that has activity before the cssh session ends. We can't guarantee that tmux will choose the right (previous) session, but we can make it more likely by filtering to only detached sessions.

See https://man.openbsd.org/tmux#detach-on-destroy for documentation.

Previously, when running tmux-cssh from an existing session, it would
reuse the current client. This is reasonable; nesting tmux sessions is
generally not a good idea. However, when the ssh commands finished, the
session would be destroyed, and the client would automatically detach,
closing the terminal. That makes it hard to understand what happened,
especially when running non-interactive commands with `-o RemoteCommand`.

Tell tmux not to detach in this case. `set-option` is automatically
scoped to the target session, so this does not affect other sessions.

Use `no-detached`, not `on` or `attach-client -f no-detach-on-destroy`,
because there may be another terminal open that has activity before the
cssh session ends. We can't guarantee that tmux will choose the right
(previous) session, but we can make it more likely by filtering to only
detached sessions.

See https://man.openbsd.org/tmux#detach-on-destroy for documentation.
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.

None yet

1 participant