aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core/job_spec.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2023-12-12 13:19:46 -0600
committerGitHub <noreply@github.com>2023-12-12 13:19:46 -0600
commit1907abb4c27857fe7f4e7394f32e130f9955a2e7 (patch)
treed60376bdedc8ac7537cec672ab0385c5e9ed5962 /test/functional/core/job_spec.lua
parent2c96f1c4f052540ad0ca5cb6f631088aa9114f9c (diff)
downloadrneovim-1907abb4c27857fe7f4e7394f32e130f9955a2e7.tar.gz
rneovim-1907abb4c27857fe7f4e7394f32e130f9955a2e7.tar.bz2
rneovim-1907abb4c27857fe7f4e7394f32e130f9955a2e7.zip
fix(stream): do not close handle if it is already closing (#26537)
uv_close asserts that a handle is not already closing. We can guard against this assertion failure by manually checking the handle's closing status ourselves.
Diffstat (limited to 'test/functional/core/job_spec.lua')
-rw-r--r--test/functional/core/job_spec.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index 6d021fb73f..bffeafc865 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
+local thelpers = require('test.functional.terminal.helpers')
local clear, eq, eval, exc_exec, feed_command, feed, insert, neq, next_msg, nvim,
testprg, ok, source, write_file, mkdir, rmdir = helpers.clear,
helpers.eq, helpers.eval, helpers.exc_exec, helpers.feed_command, helpers.feed,
@@ -1140,6 +1141,31 @@ describe('jobs', function()
command('call jobstop(' .. other_jobid .. ')')
end)
end)
+
+ it('does not close the same handle twice on exit #25086', function()
+ local filename = string.format('%s.lua', helpers.tmpname())
+ write_file(filename, [[
+ vim.api.nvim_create_autocmd('VimLeavePre', {
+ callback = function()
+ local id = vim.fn.jobstart('sleep 0')
+ vim.fn.jobwait({id})
+ end,
+ })
+ ]])
+
+ local screen = thelpers.setup_child_nvim({
+ '-i', 'NONE',
+ '-u', filename,
+ '+q'
+ })
+
+ screen:expect{grid=[[
+ |
+ [Process exited 0]{1: } |
+ |*4
+ {3:-- TERMINAL --} |
+ ]]}
+ end)
end)
describe("pty process teardown", function()