comparison src/channel.c @ 13750:3ab6198c1f9a v8.0.1747

patch 8.0.1747: MS-Windows: term_start() does not set job_info() cmd commit https://github.com/vim/vim/commit/ebe74b73677b06db7d483987a863b41cee051cc0 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 21 23:34:43 2018 +0200 patch 8.0.1747: MS-Windows: term_start() does not set job_info() cmd Problem: MS-Windows: term_start() does not set job_info() cmd. Solution: Share the code from job_start() to set jv_argv.
author Christian Brabandt <cb@256bit.org>
date Sat, 21 Apr 2018 23:45:06 +0200
parents e5244201fed6
children 5f6c61a71c02
comparison
equal deleted inserted replaced
13749:f30ac8135299 13750:3ab6198c1f9a
5561 } 5561 }
5562 else 5562 else
5563 #endif 5563 #endif
5564 if (argvars[0].v_type == VAR_STRING) 5564 if (argvars[0].v_type == VAR_STRING)
5565 { 5565 {
5566 char_u *cmd_copy;
5567
5568 /* Command is a string. */ 5566 /* Command is a string. */
5569 cmd = argvars[0].vval.v_string; 5567 cmd = argvars[0].vval.v_string;
5570 if (cmd == NULL || *cmd == NUL) 5568 if (cmd == NULL || *cmd == NUL)
5571 { 5569 {
5572 EMSG(_(e_invarg)); 5570 EMSG(_(e_invarg));
5573 goto theend; 5571 goto theend;
5574 } 5572 }
5575 /* Make a copy, parsing will modify "cmd". */ 5573
5576 cmd_copy = vim_strsave(cmd); 5574 if (build_argv_from_string(cmd, &argv, &argc) == FAIL)
5577 if (cmd_copy == NULL
5578 || mch_parse_cmd(cmd_copy, FALSE, &argv, &argc) == FAIL)
5579 {
5580 vim_free(cmd_copy);
5581 goto theend; 5575 goto theend;
5582 }
5583 for (i = 0; i < argc; i++)
5584 argv[i] = (char *)vim_strsave((char_u *)argv[i]);
5585 argv[argc] = NULL;
5586 vim_free(cmd_copy);
5587 } 5576 }
5588 else if (argvars[0].v_type != VAR_LIST 5577 else if (argvars[0].v_type != VAR_LIST
5589 || argvars[0].vval.v_list == NULL 5578 || argvars[0].vval.v_list == NULL
5590 || argvars[0].vval.v_list->lv_len < 1) 5579 || argvars[0].vval.v_list->lv_len < 1)
5591 { 5580 {
5592 EMSG(_(e_invarg)); 5581 EMSG(_(e_invarg));
5593 goto theend; 5582 goto theend;
5594 } 5583 }
5595 else 5584 else
5596 { 5585 {
5597 list_T *l = argvars[0].vval.v_list; 5586 list_T *l = argvars[0].vval.v_list;
5598 listitem_T *li; 5587
5599 char_u *s; 5588 if (build_argv_from_list(l, &argv, &argc) == FAIL)
5600
5601 /* Pass argv[] to mch_call_shell(). */
5602 argv = (char **)alloc(sizeof(char *) * (l->lv_len + 1));
5603 if (argv == NULL)
5604 goto theend; 5589 goto theend;
5605 for (li = l->lv_first; li != NULL; li = li->li_next)
5606 {
5607 s = get_tv_string_chk(&li->li_tv);
5608 if (s == NULL)
5609 {
5610 for (i = 0; i < argc; ++i)
5611 vim_free(argv[i]);
5612 goto theend;
5613 }
5614 argv[argc++] = (char *)vim_strsave(s);
5615 }
5616 argv[argc] = NULL;
5617
5618 #ifndef USE_ARGV 5590 #ifndef USE_ARGV
5619 if (win32_build_cmd(l, &ga) == FAIL) 5591 if (win32_build_cmd(l, &ga) == FAIL)
5620 goto theend; 5592 goto theend;
5621 cmd = ga.ga_data; 5593 cmd = ga.ga_data;
5622 #endif 5594 #endif