system(), jobstart(): raise error on non-executable #11234

* tv_to_argv: error when cmd is not executable
  Callers always assume that emsg was emitted:
  - https://github.com/neovim/neovim/blob/57fbf288/src/nvim/eval.c#L12509
  - https://github.com/neovim/neovim/blob/57fbf288/src/nvim/eval.c#L17923
  - https://github.com/neovim/neovim/blob/57fbf288/src/nvim/eval.c#L18202
* test/functional/provider: display reason from missing_provider
* provider#node#Detect: skip / handle non-existing node executable
This commit is contained in:
Daniel Hahler
2019-12-24 07:53:56 +01:00
committed by Justin M. Keyes
parent 53fe877a97
commit b3686b1597
8 changed files with 28 additions and 16 deletions

View File

@@ -8,6 +8,7 @@ local command = helpers.command
local exc_exec = helpers.exc_exec
local iswin = helpers.iswin
local os_kill = helpers.os_kill
local pcall_err = helpers.pcall_err
local Screen = require('test.functional.ui.screen')
@@ -32,8 +33,9 @@ describe('system()', function()
return nvim_dir..'/printargs-test' .. (iswin() and '.exe' or '')
end
it('sets v:shell_error if cmd[0] is not executable', function()
call('system', { 'this-should-not-exist' })
it('throws error if cmd[0] is not executable', function()
eq("Vim:E475: Invalid value for argument cmd: 'this-should-not-exist' is not executable",
pcall_err(call, 'system', { 'this-should-not-exist' }))
eq(-1, eval('v:shell_error'))
end)
@@ -48,7 +50,8 @@ describe('system()', function()
eq(0, eval('v:shell_error'))
-- Provoke a non-zero v:shell_error.
call('system', { 'this-should-not-exist' })
eq("Vim:E475: Invalid value for argument cmd: 'this-should-not-exist' is not executable",
pcall_err(call, 'system', { 'this-should-not-exist' }))
local old_val = eval('v:shell_error')
eq(-1, old_val)