diff options
author | Thomas Adam <thomas@xteddy.org> | 2015-12-13 16:01:13 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2015-12-13 16:01:13 +0000 |
commit | ae5ddfdc1ae471f13c6d0e94ff4029d4fb29e1f4 (patch) | |
tree | 72ebffc1c0617c28ddc421f24045f148b7d59e36 /cmd-run-shell.c | |
parent | 92f187d1c2d84322860dc595da604260999a52f0 (diff) | |
parent | ff599f4004aaa6aae325ece5cbc996e2dc6f0b4f (diff) | |
download | rtmux-ae5ddfdc1ae471f13c6d0e94ff4029d4fb29e1f4.tar.gz rtmux-ae5ddfdc1ae471f13c6d0e94ff4029d4fb29e1f4.tar.bz2 rtmux-ae5ddfdc1ae471f13c6d0e94ff4029d4fb29e1f4.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-run-shell.c')
-rw-r--r-- | cmd-run-shell.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/cmd-run-shell.c b/cmd-run-shell.c index fd5d84d4..0dae39ac 100644 --- a/cmd-run-shell.c +++ b/cmd-run-shell.c @@ -39,7 +39,7 @@ const struct cmd_entry cmd_run_shell_entry = { "run-shell", "run", "bt:", 1, 1, "[-b] " CMD_TARGET_PANE_USAGE " shell-command", - 0, + CMD_PANE_T|CMD_CANFAIL, cmd_run_shell_exec }; @@ -75,31 +75,18 @@ 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 session *s = cmdq->state.tflag.s; + struct winlink *wl = cmdq->state.tflag.wl; + struct window_pane *wp = cmdq->state.tflag.wp; struct format_tree *ft; const char *cwd; - if (args_has(args, 't')) { - wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp); - cwd = wp->cwd; - } else { - c = cmd_find_client(cmdq, NULL, 1); - if (c != NULL && c->session != NULL) { - s = c->session; - wl = s->curw; - wp = wl->window->active; - } - if (cmdq->client != NULL && cmdq->client->session == NULL) - cwd = cmdq->client->cwd; - else if (s != NULL) - cwd = s->cwd; - else - cwd = NULL; - } - + if (cmdq->client != NULL && cmdq->client->session == NULL) + cwd = cmdq->client->cwd; + else if (s != NULL) + cwd = s->cwd; + else + cwd = NULL; ft = format_create(cmdq, 0); format_defaults(ft, NULL, s, wl, wp); shellcmd = format_expand(ft, args->argv[0]); |