mirror of
https://github.com/vim/vim.git
synced 2025-10-02 05:04:20 -04:00
patch 8.2.0453: trailing space in job_start() command causes empty argument
Problem: Trailing space in job_start() command causes empty argument. Solution: Ignore trailing space. (closes #5851)
This commit is contained in:
12
src/misc2.c
12
src/misc2.c
@@ -4242,14 +4242,14 @@ mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc)
|
|||||||
* 1: find number of arguments
|
* 1: find number of arguments
|
||||||
* 2: separate them and build argv[]
|
* 2: separate them and build argv[]
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < 2; ++i)
|
for (i = 1; i <= 2; ++i)
|
||||||
{
|
{
|
||||||
p = skipwhite(cmd);
|
p = skipwhite(cmd);
|
||||||
inquote = FALSE;
|
inquote = FALSE;
|
||||||
*argc = 0;
|
*argc = 0;
|
||||||
for (;;)
|
while (*p != NUL)
|
||||||
{
|
{
|
||||||
if (i == 1)
|
if (i == 2)
|
||||||
(*argv)[*argc] = (char *)p;
|
(*argv)[*argc] = (char *)p;
|
||||||
++*argc;
|
++*argc;
|
||||||
d = p;
|
d = p;
|
||||||
@@ -4266,18 +4266,18 @@ mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc)
|
|||||||
// Second pass: Remove the backslash.
|
// Second pass: Remove the backslash.
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
if (i == 1)
|
if (i == 2)
|
||||||
*d++ = *p;
|
*d++ = *p;
|
||||||
}
|
}
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
if (*p == NUL)
|
if (*p == NUL)
|
||||||
{
|
{
|
||||||
if (i == 1)
|
if (i == 2)
|
||||||
*d++ = NUL;
|
*d++ = NUL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == 1)
|
if (i == 2)
|
||||||
*d++ = NUL;
|
*d++ = NUL;
|
||||||
p = skipwhite(p + 1);
|
p = skipwhite(p + 1);
|
||||||
}
|
}
|
||||||
|
@@ -2035,4 +2035,12 @@ func Test_issue_5485()
|
|||||||
unlet $VAR1
|
unlet $VAR1
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_job_trailing_space_unix()
|
||||||
|
CheckUnix
|
||||||
|
CheckExecutable cat
|
||||||
|
let job = job_start("cat ", #{in_io: 'null'})
|
||||||
|
call WaitForAssert({-> assert_equal("dead", job_status(job))})
|
||||||
|
call assert_equal(0, job_info(job).exitval)
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -738,6 +738,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
453,
|
||||||
/**/
|
/**/
|
||||||
452,
|
452,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user