From c4c74c3883aa3122c0c877ca8dd7b26beb5cc4aa Mon Sep 17 00:00:00 2001 From: Tommy Allen Date: Wed, 7 Nov 2018 04:31:25 -0500 Subject: jobstart(): Fix hang on non-executable cwd #9204 * os/fs.c: add os_isdir_executable() * eval.c: fix hang on job start caused by non-executable cwd option * channel.c: assert cwd is an executable directory * test: jobstart() produces error when using non-executable cwd --- test/functional/core/job_spec.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index 34168e10c2..eb02610df0 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -17,6 +17,7 @@ local pathroot = helpers.pathroot local nvim_set = helpers.nvim_set local expect_twostreams = helpers.expect_twostreams local expect_msg_seq = helpers.expect_msg_seq +local expect_err = helpers.expect_err local Screen = require('test.functional.ui.screen') -- Kill process with given pid @@ -115,6 +116,17 @@ describe('jobs', function() ok(string.find(err, "E475: Invalid argument: expected valid directory$") ~= nil) end) + it('produces error when using non-executable `cwd`', function() + if iswin() then return end -- N/A for Windows + + local dir = 'Xtest_not_executable_dir' + mkdir(dir) + funcs.setfperm(dir, 'rw-------') + expect_err('E475: Invalid argument: expected valid directory$', nvim, + 'command', "call jobstart('pwd', {'cwd': '" .. dir .. "'})") + rmdir(dir) + end) + it('returns 0 when it fails to start', function() eq("", eval("v:errmsg")) feed_command("let g:test_jobid = jobstart([])") -- cgit