From 5255793afee5653d8356b8e4d2e1009d5cf36164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Mon, 12 Aug 2024 11:41:21 +0200 Subject: [PATCH] fix(core): Enforce shutdown timer and sequence on `SIGINT` for main (#10346) --- packages/cli/src/commands/BaseCommand.ts | 2 +- packages/cli/src/commands/start.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/commands/BaseCommand.ts b/packages/cli/src/commands/BaseCommand.ts index d0c34dac0a..d2cf986af2 100644 --- a/packages/cli/src/commands/BaseCommand.ts +++ b/packages/cli/src/commands/BaseCommand.ts @@ -315,7 +315,7 @@ export abstract class BaseCommand extends Command { this.exit(exitCode); } - private onTerminationSignal(signal: string) { + protected onTerminationSignal(signal: string) { return async () => { if (this.shutdownService.isShuttingDown()) { this.logger.info(`Received ${signal}. Already shutting down...`); diff --git a/packages/cli/src/commands/start.ts b/packages/cli/src/commands/start.ts index 99df74fabd..0ebfbbc1a6 100644 --- a/packages/cli/src/commands/start.ts +++ b/packages/cli/src/commands/start.ts @@ -332,7 +332,7 @@ export class Start extends BaseCommand { this.openBrowser(); } else if (key.charCodeAt(0) === 3) { // Ctrl + c got pressed - void this.stopProcess(); + void this.onTerminationSignal('SIGINT')(); } else { // When anything else got pressed, record it and send it on enter into the child process