version 1.70, 2010/02/06 18:29:15 |
version 1.71, 2010/02/06 18:47:41 |
|
|
cmddata.pid = envdata.pid; |
cmddata.pid = envdata.pid; |
cmddata.idx = envdata.idx; |
cmddata.idx = envdata.idx; |
|
|
|
/* Prepare command for server. */ |
cmddata.argc = argc; |
cmddata.argc = argc; |
if (cmd_pack_argv( |
if (cmd_pack_argv( |
argc, argv, cmddata.argv, sizeof cmddata.argv) != 0) { |
argc, argv, cmddata.argv, sizeof cmddata.argv) != 0) { |
|
|
if (shellcmd != NULL) |
if (shellcmd != NULL) |
cmdflags |= CMD_STARTSERVER; |
cmdflags |= CMD_STARTSERVER; |
else if (argc == 0) /* new-session is the default */ |
else if (argc == 0) /* new-session is the default */ |
cmdflags |= CMD_STARTSERVER|CMD_SENDENVIRON; |
cmdflags |= CMD_STARTSERVER|CMD_SENDENVIRON|CMD_CANTNEST; |
else { |
else { |
/* |
/* |
* It sucks parsing the command string twice (in client and |
* It sucks parsing the command string twice (in client and |
|
|
cmdflags |= CMD_STARTSERVER; |
cmdflags |= CMD_STARTSERVER; |
if (cmd->entry->flags & CMD_SENDENVIRON) |
if (cmd->entry->flags & CMD_SENDENVIRON) |
cmdflags |= CMD_SENDENVIRON; |
cmdflags |= CMD_SENDENVIRON; |
|
if (cmd->entry->flags & CMD_CANTNEST) |
|
cmdflags |= CMD_CANTNEST; |
} |
} |
cmd_list_free(cmdlist); |
cmd_list_free(cmdlist); |
|
} |
|
|
|
/* |
|
* Check if this could be a nested session, if the command can't nest: |
|
* if the socket path matches $TMUX, this is probably the same server. |
|
*/ |
|
if (shellcmd == NULL && envdata.path != NULL && |
|
cmdflags & CMD_CANTNEST && |
|
(path == envdata.path || strcmp(path, envdata.path) == 0)) { |
|
log_warnx("sessions should be nested with care. " |
|
"unset $TMUX to force."); |
|
exit(1); |
} |
} |
|
|
if ((main_ibuf = client_init(path, cmdflags, flags)) == NULL) |
if ((main_ibuf = client_init(path, cmdflags, flags)) == NULL) |