]> granicus.if.org Git - vim/commitdiff
patch 8.1.0464: MS-Windows: job_info() has cmd without backslashes v8.1.0464
authorBram Moolenaar <Bram@vim.org>
Sun, 7 Oct 2018 19:36:11 +0000 (21:36 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 7 Oct 2018 19:36:11 +0000 (21:36 +0200)
Problem:    MS-Windows: job_info() has cmd without backslashes. (Daniel
            Hahler)
Solution:   Use rem_backslash(). (closes #3517, closes #3404)

src/misc2.c
src/testdir/test_channel.vim
src/version.c

index 754fcdc5d62e44887110c5d2bfe27c202e359fd8..ad96bea0c71d4003915a46fe32049a6ebc547afb 100644 (file)
@@ -6458,14 +6458,14 @@ mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc)
            while (*p != NUL && (inquote || (*p != ' ' && *p != TAB)))
            {
                if (p[0] == '"')
-                   /* quotes surrounding an argument and are dropped */
+                   // quotes surrounding an argument and are dropped
                    inquote = !inquote;
                else
                {
-                   if (p[0] == '\\' && p[1] != NUL)
+                   if (rem_backslash(p))
                    {
-                       /* First pass: skip over "\ " and "\"".
-                        * Second pass: Remove the backslash. */
+                       // First pass: skip over "\ " and "\"".
+                       // Second pass: Remove the backslash.
                        ++p;
                    }
                    if (i == 1)
index 5d071473a5ad6118ba25674bbeb88fa612c64528..832f54e7c8cc8a38eed74248cd7d217522d7029d 100644 (file)
@@ -1721,6 +1721,22 @@ func Test_read_from_terminated_job()
   call WaitForAssert({-> assert_equal(1, g:linecount)})
 endfunc
 
+func Test_job_start_windows()
+  if !has('job') || !has('win32')
+    return
+  endif
+
+  " Check that backslash in $COMSPEC is handled properly.
+  let g:echostr = ''
+  let cmd = $COMSPEC . ' /c echo 123'
+  let job = job_start(cmd, {'callback': {ch,msg -> execute(":let g:echostr .= msg")}})
+  let info = job_info(job)
+  call assert_equal([$COMSPEC, '/c', 'echo', '123'], info.cmd)
+
+  call WaitForAssert({-> assert_equal("123", g:echostr)})
+  unlet g:echostr
+endfunc
+
 func Test_env()
   if !has('job')
     return
index 90588efd97b7b19306be47d9bef6ca9f5d6188e2..8da8e7132c703f3ca28ff2f17ab50cc4b5120ce3 100644 (file)
@@ -792,6 +792,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    464,
 /**/
     463,
 /**/