mirror of
https://github.com/neovim/neovim.git
synced 2025-09-15 15:58:17 +00:00
win: jobstart(), system(): $PATHEXT-resolve exe
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
This commit is contained in:
@@ -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'))
|
||||
|
Reference in New Issue
Block a user