Skip to content

Commit

Permalink
Try to establish client for run-shell and if-shell if no -t.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicm committed Mar 25, 2013
1 parent e44bd9f commit 972da2d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd-if-shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,22 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
struct args *args = self->args;
struct cmd_if_shell_data *cdata;
char *shellcmd;
struct client *c;
struct session *s = NULL;
struct winlink *wl = NULL;
struct window_pane *wp = NULL;
struct format_tree *ft;

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)
Expand Down
9 changes: 9 additions & 0 deletions cmd-run-shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,22 @@ 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;
struct format_tree *ft;

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)
Expand Down

0 comments on commit 972da2d

Please sign in to comment.