Skip to content

Commit f232618

Browse files
committed
Detect post-spawn errors in terminal launches
1 parent 246a044 commit f232618

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/interceptors/terminal/fresh-terminal-interceptor.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,13 @@ export class FreshTerminalInterceptor implements Interceptor {
247247
reportError(e);
248248
onTerminalClosed();
249249
});
250+
251+
// Watch for spawn errors immediately after startup to judge whether the
252+
// terminal launch was actually successful:
253+
return new Promise((resolve, reject) => {
254+
setTimeout(resolve, 500); // If it doesn't crash within 500ms, it's probably good
255+
childProc.once('error', reject) // If it does crash, it's definitely not.
256+
});
250257
}
251258

252259
async deactivate(proxyPort: number | string): Promise<void> {

0 commit comments

Comments
 (0)