summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-run-shell.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2013-03-25 16:04:07 +0000
committernicm <nicm@openbsd.org>2013-03-25 16:04:07 +0000
commitc60af24b097bd5c88964f1363cc42bbe99fe16d2 (patch)
treede05b449fa095f72a4a4b9c8391c7be9e4371f9d /usr.bin/tmux/cmd-run-shell.c
parentFactor out the code that is used to recreate work units - one copy of the (diff)
downloadwireguard-openbsd-c60af24b097bd5c88964f1363cc42bbe99fe16d2.tar.xz
wireguard-openbsd-c60af24b097bd5c88964f1363cc42bbe99fe16d2.zip
Try to establish client for run-shell and if-shell if no -t.
Diffstat (limited to 'usr.bin/tmux/cmd-run-shell.c')
-rw-r--r--usr.bin/tmux/cmd-run-shell.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c
index 44e63162e90..18f93aea2b3 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.22 2013/03/25 11:43:01 nicm Exp $ */
+/* $OpenBSD: cmd-run-shell.c,v 1.23 2013/03/25 16:04:07 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -77,6 +77,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq)
struct args *args = self->args;
struct cmd_run_shell_data *cdata;
char *shellcmd;
+ struct client *c;
struct session *s = NULL;
struct winlink *wl = NULL;
struct window_pane *wp = NULL;
@@ -84,6 +85,14 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 't'))
wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp);
+ else {
+ c = cmd_find_client(cmdq, NULL, 1);
+ if (c != NULL && c->session != NULL) {
+ s = c->session;
+ wl = s->curw;
+ wp = wl->window->active;
+ }
+ }
ft = format_create();
if (s != NULL)