Skip to content

Commit 1df2fa4

Browse files
committed
patch 8.1.0464: MS-Windows: job_info() has cmd without backslashes
Problem: MS-Windows: job_info() has cmd without backslashes. (Daniel Hahler) Solution: Use rem_backslash(). (closes #3517, closes #3404)
1 parent 798184c commit 1df2fa4

3 files changed

Lines changed: 22 additions & 4 deletions

File tree

src/misc2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6458,14 +6458,14 @@ mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc)
64586458
while (*p != NUL && (inquote || (*p != ' ' && *p != TAB)))
64596459
{
64606460
if (p[0] == '"')
6461-
/* quotes surrounding an argument and are dropped */
6461+
// quotes surrounding an argument and are dropped
64626462
inquote = !inquote;
64636463
else
64646464
{
6465-
if (p[0] == '\\' && p[1] != NUL)
6465+
if (rem_backslash(p))
64666466
{
6467-
/* First pass: skip over "\ " and "\"".
6468-
* Second pass: Remove the backslash. */
6467+
// First pass: skip over "\ " and "\"".
6468+
// Second pass: Remove the backslash.
64696469
++p;
64706470
}
64716471
if (i == 1)

src/testdir/test_channel.vim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,6 +1721,22 @@ func Test_read_from_terminated_job()
17211721
call WaitForAssert({-> assert_equal(1, g:linecount)})
17221722
endfunc
17231723

1724+
func Test_job_start_windows()
1725+
if !has('job') || !has('win32')
1726+
return
1727+
endif
1728+
1729+
" Check that backslash in $COMSPEC is handled properly.
1730+
let g:echostr = ''
1731+
let cmd = $COMSPEC . ' /c echo 123'
1732+
let job = job_start(cmd, {'callback': {ch,msg -> execute(":let g:echostr .= msg")}})
1733+
let info = job_info(job)
1734+
call assert_equal([$COMSPEC, '/c', 'echo', '123'], info.cmd)
1735+
1736+
call WaitForAssert({-> assert_equal("123", g:echostr)})
1737+
unlet g:echostr
1738+
endfunc
1739+
17241740
func Test_env()
17251741
if !has('job')
17261742
return

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,8 @@ static char *(features[]) =
792792

793793
static int included_patches[] =
794794
{ /* Add new patch number below this line */
795+
/**/
796+
464,
795797
/**/
796798
463,
797799
/**/

0 commit comments

Comments
 (0)