summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-if-shell.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2018-05-24 09:42:49 +0000
committernicm <nicm@openbsd.org>2018-05-24 09:42:49 +0000
commit8a00c84cfc00a28fa8b08e6f9e7c012de7ccc786 (patch)
tree12e36be4a7f7bf31f3e2d3675296183cf5d7e3c9 /usr.bin/tmux/cmd-if-shell.c
parentImprove logging of the environment etc for new panes. (diff)
downloadwireguard-openbsd-8a00c84cfc00a28fa8b08e6f9e7c012de7ccc786.tar.xz
wireguard-openbsd-8a00c84cfc00a28fa8b08e6f9e7c012de7ccc786.zip
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 'usr.bin/tmux/cmd-if-shell.c')
-rw-r--r--usr.bin/tmux/cmd-if-shell.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c
index 6740546601f..d093073ccd2 100644
--- a/usr.bin/tmux/cmd-if-shell.c
+++ b/usr.bin/tmux/cmd-if-shell.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-if-shell.c,v 1.57 2018/03/08 08:09:10 nicm Exp $ */
+/* $OpenBSD: cmd-if-shell.c,v 1.58 2018/05/24 09:42:49 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -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'))