aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/system_spec.lua
diff options
context:
space:
mode:
authorRui Abreu Ferreira <raf-ep@gmx.com>2016-09-30 15:29:50 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-01-11 01:05:55 +0100
commit1e079fa987ac5211a1749c13a4efaa6090963fa7 (patch)
treed3815aa7d8957290323b5d7ca24bdb34babbed9c /test/functional/eval/system_spec.lua
parent4178e865d51de71430ba08fb5140333caa589097 (diff)
downloadrneovim-1e079fa987ac5211a1749c13a4efaa6090963fa7.tar.gz
rneovim-1e079fa987ac5211a1749c13a4efaa6090963fa7.tar.bz2
rneovim-1e079fa987ac5211a1749c13a4efaa6090963fa7.zip
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.
Diffstat (limited to 'test/functional/eval/system_spec.lua')
-rw-r--r--test/functional/eval/system_spec.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/functional/eval/system_spec.lua b/test/functional/eval/system_spec.lua
index 09497e85c2..bbbbdcd2ef 100644
--- a/test/functional/eval/system_spec.lua
+++ b/test/functional/eval/system_spec.lua
@@ -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)