summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-run-shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tmux/cmd-run-shell.c')
-rw-r--r--usr.bin/tmux/cmd-run-shell.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c
index d73124c928d..3d403ed4ac8 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.32 2015/12/11 12:27:36 nicm Exp $ */
+/* $OpenBSD: cmd-run-shell.c,v 1.33 2015/12/13 14:32:38 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -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]);