From f3beadfa4e4c9d38cf2ba9aac950791bc98bc87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Fri, 9 Aug 2024 17:20:28 +0200 Subject: [PATCH] fix(core): Enforce shutdown timer and sequence on `SIGINT` for main --- 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 62ff002e43298..c3691a8c7ee6d 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 99df74fabd6cd..0ebfbbc1a6dae 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