Skip to content

Commit 52e3713

Browse files
authored
Include debug and spawn in the list of promises to await (#3444)
1 parent c319a65 commit 52e3713

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

vscode/src/streamingRunner.ts

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)