changeset 18943:d90138662f49 v8.2.0032

patch 8.2.0032: MS-Windows: test for blank job fails Commit: https://github.com/vim/vim/commit/7c2a2f869b0f5a3e36f5e7d83923a264426e434c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 22 18:28:51 2019 +0100 patch 8.2.0032: MS-Windows: test for blank job fails Problem: MS-Windows: test for blank job fails Solution: Check before escaping.
author Bram Moolenaar <Bram@vim.org>
date Sun, 22 Dec 2019 18:30:03 +0100
parents 8c248bf8692f
children e90fc3f5a0ae
files src/channel.c src/testdir/test_channel.vim src/version.c
diffstat 3 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -5921,7 +5921,7 @@ job_start(
     {
 	// Command is a string.
 	cmd = argvars[0].vval.v_string;
-	if (cmd == NULL || *cmd == NUL)
+	if (cmd == NULL || *skipwhite(cmd) == NUL)
 	{
 	    emsg(_(e_invarg));
 	    goto theend;
@@ -5945,13 +5945,12 @@ job_start(
 	    goto theend;
 
 	// Empty command is invalid.
-#ifdef USE_ARGV
 	if (argc == 0 || *skipwhite((char_u *)argv[0]) == NUL)
 	{
 	    emsg(_(e_invarg));
 	    goto theend;
 	}
-#else
+#ifndef USE_ARGV
 	if (win32_build_cmd(l, &ga) == FAIL)
 	    goto theend;
 	cmd = ga.ga_data;
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -1962,6 +1962,8 @@ func Test_empty_job()
   " This was crashing on MS-Windows.
   call assert_fails('let job = job_start([""])', 'E474:')
   call assert_fails('let job = job_start(["   "])', 'E474:')
+  call assert_fails('let job = job_start("")', 'E474:')
+  call assert_fails('let job = job_start("   ")', 'E474:')
 endfunc
 
 " Do this last, it stops any channel log.
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    32,
+/**/
     31,
 /**/
     30,