summaryrefslogtreecommitdiffstats
path: root/cmd-run-shell.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-03-25 16:04:07 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-03-25 16:04:07 +0000
commit972da2d498d6e410fd97c55fb422af7caf464622 (patch)
tree4090b2248b2cdfe94542c8b5f60749a558cde415 /cmd-run-shell.c
parente44bd9f750bc374ae116a849e7ccde4efabc034a (diff)
Try to establish client for run-shell and if-shell if no -t.
Diffstat (limited to 'cmd-run-shell.c')
-rw-r--r--cmd-run-shell.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmd-run-shell.c b/cmd-run-shell.c
index e78d0e40..ef1dbdd4 100644
--- a/cmd-run-shell.c
+++ b/cmd-run-shell.c
@@ -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)