summaryrefslogtreecommitdiffstats
path: root/cmd-if-shell.c
diff options
context:
space:
mode:
authornicm <nicm>2018-05-24 09:42:49 +0000
committernicm <nicm>2018-05-24 09:42:49 +0000
commitb9a6162d2f9bea63c3ad421e9c3969eea2852b00 (patch)
treed944f370a3a21ea175f9fe958f9773146cdbfc1a /cmd-if-shell.c
parent8f5903d7c3d75763ed5dc37ff49a39fe3b3b7831 (diff)
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.
Diffstat (limited to 'cmd-if-shell.c')
-rw-r--r--cmd-if-shell.c12
1 files changed, 2 insertions, 10 deletions
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'))