Skip to content

Commit 348f4cf

Browse files
committed
Add some additional logging to help track down service shutdowns
See #5155
1 parent c8bd483 commit 348f4cf

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎src/shared/services/stdio_service.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,10 @@ export abstract class StdIOService<T> implements IAmDisposable {
299299
}
300300

301301
public dispose() {
302+
this.logTraffic(`Process ${this.description} is being disposed`);
302303
for (const pid of this.additionalPidsToTerminate) {
303304
try {
305+
this.logTraffic(`Process ${this.description} is terminating process ${pid}`);
304306
process.kill(pid);
305307
} catch (e: any) {
306308
// TODO: Logger knows the category!
@@ -310,8 +312,20 @@ export abstract class StdIOService<T> implements IAmDisposable {
310312
}
311313
this.additionalPidsToTerminate.length = 0;
312314
try {
313-
if (!this.processExited && this.process && !this.process.killed)
315+
if (!this.processExited && this.process && !this.process.killed) {
316+
this.logTraffic(`Process ${this.description} is terminating the main process`);
314317
this.process.kill();
318+
} else {
319+
if (this.processExited) {
320+
this.logTraffic(`Process ${this.description} skipped terminating because it had already exited`);
321+
} else if (!this.process) {
322+
this.logTraffic(`Process ${this.description} skipped terminating because there is no process`);
323+
} else if (this.process?.killed) {
324+
this.logTraffic(`Process ${this.description} skipped terminating because it was already killed`);
325+
} else {
326+
this.logTraffic(`Process ${this.description} skipped terminating because 🤷‍♂️`);
327+
}
328+
}
315329
} catch (e) {
316330
// This tends to throw a lot because the shell process quit when we terminated the related
317331
// process above, so just swallow the error.

0 commit comments

Comments
 (0)