Move the nested check from client to server and compare the client tty

name to all the pane pty names instead of comparing socket paths. This
means that "new -d" will work without unsetting $TMUX.
This commit is contained in:
nicm
2015-06-04 23:27:51 +00:00
parent dc0d34e137
commit 6b2129696f
5 changed files with 42 additions and 25 deletions

View File

@ -36,7 +36,7 @@ const struct cmd_entry cmd_attach_session_entry = {
"attach-session", "attach",
"c:drt:", 0, 0,
"[-dr] [-c working-directory] " CMD_TARGET_SESSION_USAGE,
CMD_CANTNEST|CMD_STARTSERVER,
CMD_STARTSERVER,
cmd_attach_session_exec
};
@ -81,6 +81,11 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
if (cmdq->client == NULL)
return (CMD_RETURN_NORMAL);
if (server_client_check_nested(cmdq->client)) {
cmdq_error(cmdq, "sessions should be nested with care, "
"unset $TMUX to force");
return (CMD_RETURN_ERROR);
}
if (wl != NULL) {
if (wp != NULL)