From 52084b2948032db4de728f4fc690760345a40ef2 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 23 Aug 2023 08:30:07 +0000 Subject: [PATCH 1/2] Log what input_dcs_dispatch does with the input data. --- input.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/input.c b/input.c index 67b5ee661..090d61ab0 100644 --- a/input.c +++ b/input.c @@ -2248,10 +2248,13 @@ input_dcs_dispatch(struct input_ctx *ictx) if (wp == NULL) return (0); - if (ictx->flags & INPUT_DISCARD) + if (ictx->flags & INPUT_DISCARD) { + log_debug("%s: %zu bytes (discard)", __func__, len); return (0); - allow_passthrough = options_get_number(wp->options, - "allow-passthrough"); + } + log_debug("%s: %zu bytes", __func__, len); + + allow_passthrough = options_get_number(wp->options, "allow-passthrough"); if (!allow_passthrough) return (0); log_debug("%s: \"%s\"", __func__, buf); From 71d453f169ffac345db3e4c82f4409fc41091002 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 23 Aug 2023 08:40:25 +0000 Subject: [PATCH 2/2] Add -c to run-shell to set working directory, from someone in GitHub issue 3661. --- cmd-run-shell.c | 14 +++++++++----- tmux.1 | 5 +++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cmd-run-shell.c b/cmd-run-shell.c index 560eface7..ddb5b1b44 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) diff --git a/tmux.1 b/tmux.1 index 7836e5f58..3228556c1 100644 --- a/tmux.1 +++ b/tmux.1 @@ -6639,6 +6639,7 @@ option. .Tg run .It Xo Ic run-shell .Op Fl bC +.Op Fl c Ar start-directory .Op Fl d Ar delay .Op Fl t Ar target-pane .Op Ar shell-command @@ -6666,6 +6667,10 @@ waits for .Ar delay seconds before starting the command. If +.Fl c +is given, the current working directory is set to +.Ar start-directory . +If .Fl C is not given, any output to stdout is displayed in view mode (in the pane specified by