diff --git a/src/cli/gateway-cli/run.ts b/src/cli/gateway-cli/run.ts index 6fd49112d30..1e28050a2d3 100644 --- a/src/cli/gateway-cli/run.ts +++ b/src/cli/gateway-cli/run.ts @@ -215,12 +215,6 @@ async function runGatewayCommand(opts: GatewayRunOpts) { throw err; } - process.on("exit", (code) => { - if (code !== 0) { - recordGatewayCrash(stateDir); - } - }); - if (devMode) { await ensureDevGatewayConfig({ reset: Boolean(opts.reset) }); } @@ -445,6 +439,12 @@ async function runGatewayCommand(opts: GatewayRunOpts) { } : undefined; + process.on("exit", (code) => { + if (code !== 0) { + recordGatewayCrash(stateDir); + } + }); + try { await runGatewayLoop({ runtime: defaultRuntime,