From ba0a7475c52ea0ba9e083934bd328fbcbfa8d532 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 22 Dec 2019 16:09:06 +0100 Subject: [PATCH] patch 8.2.0031: MS-Windows: test for empty job fails Problem: MS-Windows: test for empty job fails Solution: Check for error message, make it also fail on Unix. --- src/channel.c | 12 ++++++++++-- src/testdir/test_channel.vim | 4 ++-- src/version.c | 2 ++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/channel.c b/src/channel.c index aed234c3a..f1c2ccd33 100644 --- a/src/channel.c +++ b/src/channel.c @@ -5943,11 +5943,19 @@ job_start( if (build_argv_from_list(l, &argv, &argc) == FAIL) goto theend; -#ifndef USE_ARGV + + // Empty command is invalid. +#ifdef USE_ARGV + if (argc == 0 || *skipwhite((char_u *)argv[0]) == NUL) + { + emsg(_(e_invarg)); + goto theend; + } +#else if (win32_build_cmd(l, &ga) == FAIL) goto theend; cmd = ga.ga_data; - if (cmd == NULL) + if (cmd == NULL || *skipwhite(cmd) == NUL) { emsg(_(e_invarg)); goto theend; diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim index 24a7ae454..a7c40098d 100644 --- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -1960,8 +1960,8 @@ endfunc func Test_empty_job() " This was crashing on MS-Windows. - let job = job_start([""]) - call WaitForAssert({-> assert_equal("dead", job_status(job))}) + 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. diff --git a/src/version.c b/src/version.c index 9dbfd6ff4..7e9f4a57c 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 31, /**/ 30, /**/ -- 2.40.0