Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Commit 3b42ad1

Browse files
committed
ChildProcessStream:close: uv.run: once
1 parent 541dfcf commit 3b42ad1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

nvim/child_process_stream.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ function ChildProcessStream:close(signal)
6262
self._proc:kill('sig'..signal)
6363
end
6464

65-
uv.run()
65+
while not self.exitcode do
66+
uv.run('once')
67+
end
6668
assert(self.exitcode)
6769
native.pid_wait(self._pid)
6870
end

test/session_spec.lua

+8
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,11 @@ describe('stdio', function()
257257
assert.are.same({'notification', 'd', {6, 7}}, session:next_message())
258258
end)
259259
end)
260+
261+
it('closing session does not hang with active loop', function()
262+
local cmd = {nvim_prog, '-u', 'NONE', '--embed', '--headless'}
263+
local session1 = Session.new(ChildProcessStream.spawn(cmd))
264+
local session2 = Session.new(ChildProcessStream.spawn(cmd))
265+
session1:close()
266+
session2:close()
267+
end)

0 commit comments

Comments
 (0)