[BACK]Return to cmd-if-shell.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/cmd-if-shell.c between version 1.67 and 1.68

version 1.67, 2020/04/13 08:26:27 version 1.68, 2020/04/13 10:59:58
Line 63 
Line 63 
 cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)  cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
 {  {
         struct args                     *args = cmd_get_args(self);          struct args                     *args = cmd_get_args(self);
         struct mouse_event              *m = &item->shared->mouse;          struct cmdq_shared              *shared = cmdq_get_shared(item);
           struct cmd_find_state           *target = cmdq_get_target(item);
           struct mouse_event              *m = &shared->mouse;
         struct cmd_if_shell_data        *cdata;          struct cmd_if_shell_data        *cdata;
         char                            *shellcmd, *cmd;          char                            *shellcmd, *cmd;
         const char                      *file;          const char                      *file;
         struct cmdq_item                *new_item;          struct cmdq_item                *new_item;
         struct cmd_find_state           *fs = &item->target;  
         struct client                   *c = cmd_find_client(item, NULL, 1);          struct client                   *c = cmd_find_client(item, NULL, 1);
         struct session                  *s = fs->s;          struct session                  *s = target->s;
         struct winlink                  *wl = fs->wl;  
         struct window_pane              *wp = fs->wp;  
         struct cmd_parse_input           pi;          struct cmd_parse_input           pi;
         struct cmd_parse_result         *pr;          struct cmd_parse_result         *pr;
   
         shellcmd = format_single(item, args->argv[0], c, s, wl, wp);          shellcmd = format_single_from_target(item, args->argv[0], c);
         if (args_has(args, 'F')) {          if (args_has(args, 'F')) {
                 if (*shellcmd != '0' && *shellcmd != '\0')                  if (*shellcmd != '0' && *shellcmd != '\0')
                         cmd = args->argv[1];                          cmd = args->argv[1];
Line 92 
Line 91 
                 cmd_get_source(self, &pi.file, &pi.line);                  cmd_get_source(self, &pi.file, &pi.line);
                 pi.item = item;                  pi.item = item;
                 pi.c = c;                  pi.c = c;
                 cmd_find_copy_state(&pi.fs, fs);                  cmd_find_copy_state(&pi.fs, target);
   
                 pr = cmd_parse_from_string(cmd, &pi);                  pr = cmd_parse_from_string(cmd, &pi);
                 switch (pr->status) {                  switch (pr->status) {
Line 103 
Line 102 
                         free(pr->error);                          free(pr->error);
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 case CMD_PARSE_SUCCESS:                  case CMD_PARSE_SUCCESS:
                         new_item = cmdq_get_command(pr->cmdlist, fs, m, 0);                          new_item = cmdq_get_command(pr->cmdlist, target, m, 0);
                         cmdq_insert_after(item, new_item);                          cmdq_insert_after(item, new_item);
                         cmd_list_free(pr->cmdlist);                          cmd_list_free(pr->cmdlist);
                         break;                          break;
Line 121 
Line 120 
         memcpy(&cdata->mouse, m, sizeof cdata->mouse);          memcpy(&cdata->mouse, m, sizeof cdata->mouse);
   
         if (!args_has(args, 'b'))          if (!args_has(args, 'b'))
                 cdata->client = item->client;                  cdata->client = cmdq_get_client(item);
         else          else
                 cdata->client = c;                  cdata->client = c;
         if (cdata->client != NULL)          if (cdata->client != NULL)
Line 139 
Line 138 
         cdata->input.c = c;          cdata->input.c = c;
         if (cdata->input.c != NULL)          if (cdata->input.c != NULL)
                 cdata->input.c->references++;                  cdata->input.c->references++;
         cmd_find_copy_state(&cdata->input.fs, fs);          cmd_find_copy_state(&cdata->input.fs, target);
   
         if (job_run(shellcmd, s, server_client_get_cwd(item->client, s), NULL,          if (job_run(shellcmd, s,
               server_client_get_cwd(cmdq_get_client(item), s), NULL,
             cmd_if_shell_callback, cmd_if_shell_free, cdata, 0, -1,              cmd_if_shell_callback, cmd_if_shell_free, cdata, 0, -1,
             -1) == NULL) {              -1) == NULL) {
                 cmdq_error(item, "failed to run command: %s", shellcmd);                  cmdq_error(item, "failed to run command: %s", shellcmd);

Legend:
Removed from v.1.67  
changed lines
  Added in v.1.68