@@ -136,6 +136,15 @@ export class StreamingRunner implements vscode.Disposable {
136136 new Error ( "Failed to start debugging session" ) ,
137137 ) ;
138138 }
139+
140+ const promise = new Promise < void > ( ( resolve ) => {
141+ const disposable = vscode . debug . onDidTerminateDebugSession ( ( _session ) => {
142+ disposable . dispose ( ) ;
143+ resolve ( ) ;
144+ } ) ;
145+ } ) ;
146+
147+ this . promises . push ( promise ) ;
139148 }
140149
141150 // Run the given test in the terminal
@@ -182,21 +191,29 @@ export class StreamingRunner implements vscode.Disposable {
182191 cwd : string ,
183192 abortController : AbortController ,
184193 ) {
185- const testProcess = spawn ( command , {
186- env : { ...env , RUBY_LSP_REPORTER_PORT : this . tcpPort } ,
187- stdio : [ "pipe" , "pipe" , "pipe" ] ,
188- shell : true ,
189- signal : abortController . signal ,
190- cwd,
191- } ) ;
194+ const promise = new Promise < void > ( ( resolve , _reject ) => {
195+ const testProcess = spawn ( command , {
196+ env : { ...env , RUBY_LSP_REPORTER_PORT : this . tcpPort } ,
197+ stdio : [ "pipe" , "pipe" , "pipe" ] ,
198+ shell : true ,
199+ signal : abortController . signal ,
200+ cwd,
201+ } ) ;
192202
193- testProcess . stdout . on ( "data" , ( data ) => {
194- this . run ! . appendOutput ( data . toString ( ) . replace ( / \n / g, "\r\n" ) ) ;
195- } ) ;
203+ testProcess . stdout . on ( "data" , ( data ) => {
204+ this . run ! . appendOutput ( data . toString ( ) . replace ( / \n / g, "\r\n" ) ) ;
205+ } ) ;
206+
207+ testProcess . stderr . on ( "data" , ( data ) => {
208+ this . run ! . appendOutput ( data . toString ( ) . replace ( / \n / g, "\r\n" ) ) ;
209+ } ) ;
196210
197- testProcess . stderr . on ( "data" , ( data ) => {
198- this . run ! . appendOutput ( data . toString ( ) . replace ( / \n / g, "\r\n" ) ) ;
211+ testProcess . on ( "exit" , ( _code ) => {
212+ resolve ( ) ;
213+ } ) ;
199214 } ) ;
215+
216+ this . promises . push ( promise ) ;
200217 }
201218
202219 private startServer ( ) {
0 commit comments