summaryrefslogtreecommitdiffstats
path: root/cmd-run-shell.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:34:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:34:56 +0000
commit671f456761fc66649260e831ceee36ec3d4ba9ca (patch)
tree033c56bded071f681e1304311ba0bff449d477cc /cmd-run-shell.c
parentAdding debian version 3.3a-5. (diff)
downloadtmux-671f456761fc66649260e831ceee36ec3d4ba9ca.tar.xz
tmux-671f456761fc66649260e831ceee36ec3d4ba9ca.zip
Merging upstream version 3.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--cmd-run-shell.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/cmd-run-shell.c b/cmd-run-shell.c
index 560efac..ddb5b1b 100644
--- a/cmd-run-shell.c
+++ b/cmd-run-shell.c
@@ -44,8 +44,9 @@ const struct cmd_entry cmd_run_shell_entry = {
.name = "run-shell",
.alias = "run",
- .args = { "bd:Ct:", 0, 1, cmd_run_shell_args_parse },
- .usage = "[-bC] [-d delay] " CMD_TARGET_PANE_USAGE " [shell-command]",
+ .args = { "bd:Ct:c:", 0, 2, cmd_run_shell_args_parse },
+ .usage = "[-bC] [-c start-directory] [-d delay] " CMD_TARGET_PANE_USAGE
+ " [shell-command]",
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
@@ -103,6 +104,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item)
struct args *args = cmd_get_args(self);
struct cmd_find_state *target = cmdq_get_target(item);
struct cmd_run_shell_data *cdata;
+ struct client *c = cmdq_get_client(item);
struct client *tc = cmdq_get_target_client(item);
struct session *s = target->s;
struct window_pane *wp = target->wp;
@@ -137,7 +139,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item)
cdata->wp_id = -1;
if (wait) {
- cdata->client = cmdq_get_client(item);
+ cdata->client = c;
cdata->item = item;
} else {
cdata->client = tc;
@@ -145,8 +147,10 @@ cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item)
}
if (cdata->client != NULL)
cdata->client->references++;
-
- cdata->cwd = xstrdup(server_client_get_cwd(cmdq_get_client(item), s));
+ if (args_has(args, 'c'))
+ cdata->cwd = xstrdup(args_get(args, 'c'));
+ else
+ cdata->cwd = xstrdup(server_client_get_cwd(c, s));
cdata->s = s;
if (s != NULL)