From b9a6162d2f9bea63c3ad421e9c3969eea2852b00 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 24 May 2018 09:42:49 +0000 Subject: Make server_client_get_cwd used (almost) everywhere we need to work out the cwd, and do not fall back to "." as it is pretty useless. GitHub issue 1331. --- cmd-if-shell.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'cmd-if-shell.c') diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 304fe910..d7ce3039 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -73,14 +73,6 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) struct session *s = item->target.s; struct winlink *wl = item->target.wl; struct window_pane *wp = item->target.wp; - const char *cwd; - - if (item->client != NULL && item->client->session == NULL) - cwd = item->client->cwd; - else if (s != NULL) - cwd = s->cwd; - else - cwd = NULL; shellcmd = format_single(item, args->argv[0], c, s, wl, wp); if (args_has(args, 'F')) { @@ -128,8 +120,8 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) cdata->item = NULL; memcpy(&cdata->mouse, &shared->mouse, sizeof cdata->mouse); - job_run(shellcmd, s, cwd, NULL, cmd_if_shell_callback, - cmd_if_shell_free, cdata, 0); + job_run(shellcmd, s, server_client_get_cwd(item->client, s), NULL, + cmd_if_shell_callback, cmd_if_shell_free, cdata, 0); free(shellcmd); if (args_has(args, 'b')) -- cgit