diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2019-07-29 10:51:30 +0100 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2019-07-29 10:51:30 +0100 |
commit | da552eb73b80bab3c0a28dfb9ae2c75fa6d4bdaf (patch) | |
tree | cf9c86c3218659faf46e606a1e38bc6ebb570dcd /cmd-if-shell.c | |
parent | 5a501a8ae27c2d0128870caa48c5708e97528567 (diff) | |
parent | b90a9fcd13f4434aed0fe1785d619aa668bbc77d (diff) | |
download | rtmux-da552eb73b80bab3c0a28dfb9ae2c75fa6d4bdaf.tar.gz rtmux-da552eb73b80bab3c0a28dfb9ae2c75fa6d4bdaf.tar.bz2 rtmux-da552eb73b80bab3c0a28dfb9ae2c75fa6d4bdaf.zip |
Merge branch 'master' into 3.0-rc
Diffstat (limited to 'cmd-if-shell.c')
-rw-r--r-- | cmd-if-shell.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 84f66657..2befbc0c 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -67,10 +67,11 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) struct cmd_if_shell_data *cdata; char *shellcmd, *cmd; struct cmdq_item *new_item; + struct cmd_find_state *fs = &item->target; struct client *c = cmd_find_client(item, NULL, 1); - struct session *s = item->target.s; - struct winlink *wl = item->target.wl; - struct window_pane *wp = item->target.wp; + struct session *s = fs->s; + struct winlink *wl = fs->wl; + struct window_pane *wp = fs->wp; struct cmd_parse_input pi; struct cmd_parse_result *pr; @@ -92,7 +93,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) pi.line = self->line; pi.item = item; pi.c = c; - cmd_find_copy_state(&pi.fs, &item->target); + cmd_find_copy_state(&pi.fs, fs); pr = cmd_parse_from_string(cmd, &pi); switch (pr->status) { @@ -103,7 +104,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) free(pr->error); return (CMD_RETURN_ERROR); case CMD_PARSE_SUCCESS: - new_item = cmdq_get_command(pr->cmdlist, NULL, m, 0); + new_item = cmdq_get_command(pr->cmdlist, fs, m, 0); cmdq_insert_after(item, new_item); cmd_list_free(pr->cmdlist); break; @@ -120,7 +121,10 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) cdata->cmd_else = NULL; memcpy(&cdata->mouse, m, sizeof cdata->mouse); - cdata->client = item->client; + if (!args_has(args, 'b')) + cdata->client = item->client; + else + cdata->client = c; if (cdata->client != NULL) cdata->client->references++; @@ -137,7 +141,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) cdata->input.c = c; if (cdata->input.c != NULL) cdata->input.c->references++; - cmd_find_copy_state(&cdata->input.fs, &item->target); + cmd_find_copy_state(&cdata->input.fs, fs); if (job_run(shellcmd, s, server_client_get_cwd(item->client, s), NULL, cmd_if_shell_callback, cmd_if_shell_free, cdata, 0) == NULL) { @@ -195,7 +199,7 @@ cmd_if_shell_callback(struct job *job) out: if (cdata->item != NULL) - cdata->item->flags &= ~CMDQ_WAITING; + cmdq_continue(cdata->item); } static void |