@@ -136,6 +136,15 @@ export class StreamingRunner implements vscode.Disposable {
136
136
new Error ( "Failed to start debugging session" ) ,
137
137
) ;
138
138
}
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 ) ;
139
148
}
140
149
141
150
// Run the given test in the terminal
@@ -182,21 +191,29 @@ export class StreamingRunner implements vscode.Disposable {
182
191
cwd : string ,
183
192
abortController : AbortController ,
184
193
) {
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
+ } ) ;
192
202
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
+ } ) ;
196
210
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
+ } ) ;
199
214
} ) ;
215
+
216
+ this . promises . push ( promise ) ;
200
217
}
201
218
202
219
private startServer ( ) {
0 commit comments