aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-02-10 10:26:18 +0100
committerbfredl <bjorn.linse@gmail.com>2023-02-10 20:19:04 +0100
commit0837980db4958baca96449869d31120f349f3500 (patch)
treef83ca7933693aaee4024731996736af8091db22a
parentf8f82901cdd0ccd5308e05c73af6deb7d083720f (diff)
downloadrneovim-0837980db4958baca96449869d31120f349f3500.tar.gz
rneovim-0837980db4958baca96449869d31120f349f3500.tar.bz2
rneovim-0837980db4958baca96449869d31120f349f3500.zip
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)
-rw-r--r--test/client/uv_stream.lua15
1 files changed, 10 insertions, 5 deletions
diff --git a/test/client/uv_stream.lua b/test/client/uv_stream.lua
index 1f4414c934..cea77f0dbd 100644
--- a/test/client/uv_stream.lua
+++ b/test/client/uv_stream.lua
@@ -102,8 +102,9 @@ ChildProcessStream.__index = ChildProcessStream
function ChildProcessStream.spawn(argv, env, io_extra)
local self = setmetatable({
- _child_stdin = uv.new_pipe(false),
- _child_stdout = uv.new_pipe(false)
+ _child_stdin = uv.new_pipe(false);
+ _child_stdout = uv.new_pipe(false);
+ _exiting = false;
}, ChildProcessStream)
local prog = argv[1]
local args = {}
@@ -114,8 +115,9 @@ function ChildProcessStream.spawn(argv, env, io_extra)
stdio = {self._child_stdin, self._child_stdout, 2, io_extra},
args = args,
env = env,
- }, function()
- self:close()
+ }, function(status, signal)
+ self.status = status
+ self.signal = signal
end)
if not self._proc then
@@ -154,7 +156,10 @@ function ChildProcessStream:close(signal)
if type(signal) == 'string' then
self._proc:kill('sig'..signal)
end
- uv.run('nowait')
+ while self.status == nil do
+ uv.run 'once'
+ end
+ return self.status, self.signal
end
return {