When reusing an existing client, don't detach when ssh finishes#9
Open
jyn514 wants to merge 1 commit intopeikk0:masterfrom
Open
When reusing an existing client, don't detach when ssh finishes#9jyn514 wants to merge 1 commit intopeikk0:masterfrom
jyn514 wants to merge 1 commit intopeikk0:masterfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-optionis automatically scoped to the target session, so this does not affect other sessions.Use
no-detached, notonorattach-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.