mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 09:12:07 +00:00
system([...]): Set v:shell_error=-1 if not executable.
Do _not_ set v:shell_error on parameter validation error. system([...]) does not invoke a shell, so this change is somewhat questionable. But `:help v:shell_error` is sufficiently vague to allow -1 in this case.
This commit is contained in:

committed by
Justin M. Keyes

parent
4178e865d5
commit
1e079fa987
@@ -33,9 +33,15 @@ describe('system()', function()
|
||||
local printargs_path = helpers.nvim_dir..'/printargs-test'
|
||||
.. (helpers.os_name() == 'windows' and '.exe' or '')
|
||||
|
||||
it('sets v:shell_error if cmd[0] is not executable', function()
|
||||
call('system', { 'this-should-not-exist' })
|
||||
eq(-1, eval('v:shell_error'))
|
||||
end)
|
||||
|
||||
it('quotes arguments correctly #5280', function()
|
||||
local out = call('system',
|
||||
{ printargs_path, [[1]], [[2 "3]], [[4 ' 5]], [[6 ' 7']] })
|
||||
|
||||
eq(0, eval('v:shell_error'))
|
||||
eq([[arg1=1;arg2=2 "3;arg3=4 ' 5;arg4=6 ' 7';]], out)
|
||||
|
||||
|
Reference in New Issue
Block a user