mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
fix(client): wait for session to exit
This replicates the old native.pid_wait(self._pid) call, except using the proper libuv pattern (run loop unitil exit callback)
This commit is contained in:
parent
f8f82901cd
commit
0837980db4
@ -102,8 +102,9 @@ ChildProcessStream.__index = ChildProcessStream
|
|||||||
|
|
||||||
function ChildProcessStream.spawn(argv, env, io_extra)
|
function ChildProcessStream.spawn(argv, env, io_extra)
|
||||||
local self = setmetatable({
|
local self = setmetatable({
|
||||||
_child_stdin = uv.new_pipe(false),
|
_child_stdin = uv.new_pipe(false);
|
||||||
_child_stdout = uv.new_pipe(false)
|
_child_stdout = uv.new_pipe(false);
|
||||||
|
_exiting = false;
|
||||||
}, ChildProcessStream)
|
}, ChildProcessStream)
|
||||||
local prog = argv[1]
|
local prog = argv[1]
|
||||||
local args = {}
|
local args = {}
|
||||||
@ -114,8 +115,9 @@ function ChildProcessStream.spawn(argv, env, io_extra)
|
|||||||
stdio = {self._child_stdin, self._child_stdout, 2, io_extra},
|
stdio = {self._child_stdin, self._child_stdout, 2, io_extra},
|
||||||
args = args,
|
args = args,
|
||||||
env = env,
|
env = env,
|
||||||
}, function()
|
}, function(status, signal)
|
||||||
self:close()
|
self.status = status
|
||||||
|
self.signal = signal
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if not self._proc then
|
if not self._proc then
|
||||||
@ -154,7 +156,10 @@ function ChildProcessStream:close(signal)
|
|||||||
if type(signal) == 'string' then
|
if type(signal) == 'string' then
|
||||||
self._proc:kill('sig'..signal)
|
self._proc:kill('sig'..signal)
|
||||||
end
|
end
|
||||||
uv.run('nowait')
|
while self.status == nil do
|
||||||
|
uv.run 'once'
|
||||||
|
end
|
||||||
|
return self.status, self.signal
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user