From e36846ec7b67da2ed78034091ebfd6736ba69eb4 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 22 Jul 2020 16:17:35 +0100 Subject: [PATCH 1/2] Add kill signal logic to exec --- CHANGELOG.md | 1 + src/emulator/commandUtils.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ce4d28ef8d..867ac71b809 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ - Fixes issue where `Authorization` header was missing from callable functions in the emulator (#2459). - Improve support for the Node.js 12 (Beta) runtime in the Functions emulator. - Allow specifying the config (`firebase.json`) file using the `--config`/`-c` flag. +- Fixes issue where `emulators:exec` could fail to shut down cleanly (#2477). diff --git a/src/emulator/commandUtils.ts b/src/emulator/commandUtils.ts index 300ce570e59..f4854467c48 100644 --- a/src/emulator/commandUtils.ts +++ b/src/emulator/commandUtils.ts @@ -374,6 +374,7 @@ async function runScript(script: string, extraEnv: Record): Prom * @param options: A Commander options object. */ export async function emulatorExec(script: string, options: any) { + const killSignalPromise = shutdownWhenKilled(options); const projectId = getProjectId(options, true); const extraEnv: Record = {}; if (projectId) { From 09a2e8049ab12a1d814979378dfaf92438bdc196 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 22 Jul 2020 16:19:43 +0100 Subject: [PATCH 2/2] Unused --- src/emulator/commandUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emulator/commandUtils.ts b/src/emulator/commandUtils.ts index f4854467c48..8bf6a70d4fe 100644 --- a/src/emulator/commandUtils.ts +++ b/src/emulator/commandUtils.ts @@ -374,7 +374,7 @@ async function runScript(script: string, extraEnv: Record): Prom * @param options: A Commander options object. */ export async function emulatorExec(script: string, options: any) { - const killSignalPromise = shutdownWhenKilled(options); + shutdownWhenKilled(options); const projectId = getProjectId(options, true); const extraEnv: Record = {}; if (projectId) {