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

Commit cf5beb9

Browse files
committed
feat(ChildProcessStream): capture exit code on exit
1 parent 12d070b commit cf5beb9

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

nvim/child_process_stream.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ function ChildProcessStream.spawn(argv, env, io_extra)
1919
stdio = {self._child_stdin, self._child_stdout, 2, io_extra},
2020
args = args,
2121
env = env,
22-
}, function()
22+
}, function(ecode)
23+
self._exit_code = ecode
2324
self:close()
2425
end)
2526

test/session_spec.lua

+12
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,18 @@ test_session("Session using ChidProcessStream", function ()
168168
return Session.new(proc_stream)
169169
end)
170170

171+
describe("ChildProcessStream", function()
172+
it("can capture exit code", function()
173+
local proc_stream = ChildProcessStream.spawn({
174+
nvim_prog, '-u', 'NONE', '--embed',
175+
})
176+
177+
proc_stream:close()
178+
179+
assert.is_not_nil(proc_stream._exit_code)
180+
end)
181+
end)
182+
171183
-- Session using SocketStream
172184
test_session(string.format("Session using SocketStream [%s]", socket_file), function ()
173185
child_session = Session.new(ChildProcessStream.spawn({

0 commit comments

Comments
 (0)