From e963101c032c90de4a7bc7be185e8ec7ab0d7247 Mon Sep 17 00:00:00 2001 From: Michael Grant Date: Sun, 20 Sep 2026 22:38:33 +0100 Subject: [PATCH] cmd-run-shell: expand formats in -c start-directory -c was taken as a literal string, so run-shell -c '#{pane_current_path}' tried to chdir into that literal text instead of the target pane's directory, silently falling back to the server's own cwd. Expand it through a format tree built from the command's target the same way the shell-command argument already is. Co-Authored-By: Claude Sonnet 5 --- cmd-run-shell.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd-run-shell.c b/cmd-run-shell.c index 7e0c62e56..485dca765 100644 --- a/cmd-run-shell.c +++ b/cmd-run-shell.c @@ -163,9 +163,11 @@ cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item) } if (cdata->client != NULL) cdata->client->references++; - if (args_has(args, 'c')) - cdata->cwd = xstrdup(args_get(args, 'c')); - else + if (args_has(args, 'c')) { + ft = format_create_from_target(item); + cdata->cwd = format_expand(ft, args_get(args, 'c')); + format_free(ft); + } else cdata->cwd = xstrdup(server_client_get_cwd(c, s)); if (args_has(args, 'E'))