From 7fa9fa55721f1f9bc14196e295f41fc59937f954 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 10 Oct 2019 18:04:15 +0200 Subject: [PATCH] ChildProcessStream: store exitcode/exitsignal --- nvim/child_process_stream.lua | 4 +++- nvim/session.lua | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nvim/child_process_stream.lua b/nvim/child_process_stream.lua index 5125a0e..fc66334 100644 --- a/nvim/child_process_stream.lua +++ b/nvim/child_process_stream.lua @@ -19,7 +19,9 @@ function ChildProcessStream.spawn(argv, env) stdio = {self._child_stdin, self._child_stdout, 2}, args = args, env = env, - }, function() + }, function(code, signal) + self.exitcode = code + self.exitsignal = signal self:close() end) diff --git a/nvim/session.lua b/nvim/session.lua index 7745d3c..231e58a 100644 --- a/nvim/session.lua +++ b/nvim/session.lua @@ -175,7 +175,12 @@ function Session:_run(request_cb, notification_cb, timeout) self._prepare:stop() end) end - self._msgpack_rpc_stream:read_start(request_cb, notification_cb, uv.stop) + self._msgpack_rpc_stream:read_start(request_cb, notification_cb, function() + uv.run() -- run the loop to get exitcode from child process. + self.child_exit = self._msgpack_rpc_stream._stream.exitcode + self.child_signal = self._msgpack_rpc_stream._stream.exitsignal + uv.stop() + end) uv.run() self._prepare:stop() self._timer:stop()