aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatthew Malcomson <hardenedapple@gmail.com>2017-01-21 14:11:30 +0000
committerJustin M. Keyes <justinkz@gmail.com>2017-03-17 12:20:51 +0100
commitf6946c68aee90c6ae8337b3e42c72943e37a507e (patch)
tree477386daf3393c1a71fec15eac3d75ec46d283d0 /test
parentad1884be0dcf029f7467e5cfad8ffe7c8ba461b6 (diff)
downloadrneovim-f6946c68aee90c6ae8337b3e42c72943e37a507e.tar.gz
rneovim-f6946c68aee90c6ae8337b3e42c72943e37a507e.tar.bz2
rneovim-f6946c68aee90c6ae8337b3e42c72943e37a507e.zip
job-control: set CLOEXEC on pty processes. #5986
Before this change, new processes started with libuv prevented SIGHUP from reaching pty processes (by keeping the ptmx file descriptor open).
Diffstat (limited to 'test')
-rw-r--r--test/functional/core/job_spec.lua24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index b551adb8db..e442c2a317 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
-local clear, eq, eval, execute, feed, insert, neq, next_msg, nvim,
+local clear, eq, eval, exc_exec, execute, feed, insert, neq, next_msg, nvim,
nvim_dir, ok, source, write_file, mkdir, rmdir = helpers.clear,
- helpers.eq, helpers.eval, helpers.execute, helpers.feed,
+ helpers.eq, helpers.eval, helpers.exc_exec, helpers.execute, helpers.feed,
helpers.insert, helpers.neq, helpers.next_message, helpers.nvim,
helpers.nvim_dir, helpers.ok, helpers.source,
helpers.write_file, helpers.mkdir, helpers.rmdir
@@ -622,6 +622,26 @@ describe('jobs', function()
msg = (msg[2] == 'stdout') and next_msg() or msg -- Skip stdout, if any.
eq({'notification', 'exit', {0, 42}}, msg)
end)
+
+ it('jobstart() does not keep ptmx file descriptor open', function()
+ -- Start another job (using libuv)
+ command('let g:job_opts.pty = 0')
+ local other_jobid = eval("jobstart(['cat', '-'], g:job_opts)")
+ local other_pid = eval('jobpid(' .. other_jobid .. ')')
+
+ -- Other job doesn't block first job from recieving SIGHUP on jobclose()
+ command('call jobclose(j)')
+ -- Have to wait so that the SIGHUP can be processed by tty-test on time.
+ -- Can't wait for the next message in case this test fails, if it fails
+ -- there won't be any more messages, and the test would hang.
+ helpers.sleep(100)
+ local err = exc_exec('call jobpid(j)')
+ eq('Vim(call):E900: Invalid job id', err)
+
+ -- cleanup
+ eq(other_pid, eval('jobpid(' .. other_jobid .. ')'))
+ command('call jobstop(' .. other_jobid .. ')')
+ end)
end)
end)