From b08dc3ec195feb4ab69c898ab816c104d2aa1aa1 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Jul 2019 16:37:07 +0200 Subject: win: jobstart(), system(): $PATHEXT-resolve exe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Windows: In order for jobstart(['foo']), system(['foo']) to find "foo.cmd", we must replace "foo" with "foo.cmd" before sending `argv` to process_spawn(). Rationale: jobstart([…]), system([…]) "executable" semantics should be consistent with the VimL executable() function. fix #9569 related: #10554 --- test/functional/eval/executable_spec.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'test/functional/eval/executable_spec.lua') diff --git a/test/functional/eval/executable_spec.lua b/test/functional/eval/executable_spec.lua index 1107fe6a0b..a1cf056907 100644 --- a/test/functional/eval/executable_spec.lua +++ b/test/functional/eval/executable_spec.lua @@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local eq, clear, call, iswin, write_file, command = helpers.eq, helpers.clear, helpers.call, helpers.iswin, helpers.write_file, helpers.command +local eval = helpers.eval describe('executable()', function() before_each(clear) @@ -95,10 +96,16 @@ describe('executable() (Windows)', function() eq(0, call('executable', '.\\test_executable_zzz')) end) + it('system([…]), jobstart([…]) use $PATHEXT #9569', function() + -- Invoking `cmdscript` should find/execute `cmdscript.cmd`. + eq('much success\n', call('system', {'test/functional/fixtures/cmdscript'})) + assert(0 < call('jobstart', {'test/functional/fixtures/cmdscript'})) + end) + it('full path with extension', function() -- Some executable we can expect in the test env. local exe = 'printargs-test' - local exedir = helpers.eval("fnamemodify(v:progpath, ':h')") + local exedir = eval("fnamemodify(v:progpath, ':h')") local exepath = exedir..'/'..exe..'.exe' eq(1, call('executable', exepath)) eq('arg1=lemon;arg2=sky;arg3=tree;', @@ -108,7 +115,7 @@ describe('executable() (Windows)', function() it('full path without extension', function() -- Some executable we can expect in the test env. local exe = 'printargs-test' - local exedir = helpers.eval("fnamemodify(v:progpath, ':h')") + local exedir = eval("fnamemodify(v:progpath, ':h')") local exepath = exedir..'/'..exe eq('arg1=lemon;arg2=sky;arg3=tree;', call('system', exepath..' lemon sky tree')) -- cgit