summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-run-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-run-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-run-shell.c')
-rw-r--r--usr.bin/tmux/cmd-run-shell.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c
index 0950c81bd8b..f97191ed3d6 100644
--- a/usr.bin/tmux/cmd-run-shell.c
+++ b/usr.bin/tmux/cmd-run-shell.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-run-shell.c,v 1.52 2018/03/08 08:09:10 nicm Exp $ */
+/* $OpenBSD: cmd-run-shell.c,v 1.53 2018/05/24 09:42:49 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -90,14 +90,6 @@ cmd_run_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;
cdata = xcalloc(1, sizeof *cdata);
cdata->cmd = format_single(item, args->argv[0], c, s, wl, wp);
@@ -110,8 +102,8 @@ cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item)
if (!args_has(args, 'b'))
cdata->item = item;
- job_run(cdata->cmd, s, cwd, NULL, cmd_run_shell_callback,
- cmd_run_shell_free, cdata, 0);
+ job_run(cdata->cmd, s, server_client_get_cwd(item->client, s), NULL,
+ cmd_run_shell_callback, cmd_run_shell_free, cdata, 0);
if (args_has(args, 'b'))
return (CMD_RETURN_NORMAL);