mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 21:56:57 +00:00
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:
@ -41,7 +41,7 @@ const struct cmd_entry cmd_new_session_entry = {
|
||||
"[-AdDP] [-c start-directory] [-F format] [-n window-name] "
|
||||
"[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] "
|
||||
"[-y height] [command]",
|
||||
CMD_STARTSERVER|CMD_CANTNEST,
|
||||
CMD_STARTSERVER,
|
||||
cmd_new_session_exec
|
||||
};
|
||||
|
||||
@ -145,15 +145,20 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the termios settings, part of which is used for new windows in
|
||||
* this session.
|
||||
* If this is a new client, check for nesting and save the termios
|
||||
* settings (part of which is used for new windows in this session).
|
||||
*
|
||||
* This is read again with tcgetattr() rather than using tty.tio as if
|
||||
* detached, tty_open won't be called. Because of this, it must be done
|
||||
* before opening the terminal as that calls tcsetattr() to prepare for
|
||||
* tmux taking over.
|
||||
* tcgetattr() is used rather than using tty.tio since if the client is
|
||||
* detached, tty_open won't be called. It must be done before opening
|
||||
* the terminal as that calls tcsetattr() to prepare for tmux taking
|
||||
* over.
|
||||
*/
|
||||
if (!detached && !already_attached && c->tty.fd != -1) {
|
||||
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 (tcgetattr(c->tty.fd, &tio) != 0)
|
||||
fatal("tcgetattr failed");
|
||||
tiop = &tio;
|
||||
|
Reference in New Issue
Block a user