@@ -4,6 +4,7 @@ local SocketStream = require('nvim.socket_stream')
4
4
local Session = require (' nvim.session' )
5
5
local coxpcall = require (' coxpcall' )
6
6
local busted = require (' busted' )
7
+ local uv = require (' luv' )
7
8
require (' nvim._compat' )
8
9
9
10
local nvim_prog = os.getenv (' NVIM_PROG' ) or ' nvim'
@@ -168,6 +169,38 @@ test_session("Session using ChidProcessStream", function ()
168
169
return Session .new (proc_stream )
169
170
end )
170
171
172
+ describe (" ChildProcessStream" , function ()
173
+ local session , proc_stream
174
+
175
+ before_each (function ()
176
+ proc_stream = ChildProcessStream .spawn ({
177
+ nvim_prog , ' --clean' , ' --embed' ,
178
+ })
179
+ session = Session .new (proc_stream )
180
+ session :request " nvim_get_api_info"
181
+ end )
182
+
183
+ after_each (function ()
184
+ session :close ()
185
+ proc_stream :close ()
186
+ end )
187
+
188
+ it (" can capture exit code" , function ()
189
+ session :request (" nvim_command" , " qall!" )
190
+ uv .run ()
191
+
192
+ assert .is .same (proc_stream ._exit_code , 0 )
193
+ assert .is .same (proc_stream ._signal , 0 )
194
+ end )
195
+
196
+ it (" can can capture signal" , function ()
197
+ session :close ()
198
+
199
+ assert .is .same (proc_stream ._exit_code , 0 )
200
+ assert .is .same (proc_stream ._signal , 9 )
201
+ end )
202
+ end )
203
+
171
204
-- Session using SocketStream
172
205
test_session (string.format (" Session using SocketStream [%s]" , socket_file ), function ()
173
206
child_session = Session .new (ChildProcessStream .spawn ({
0 commit comments