diff --git a/packages/node-api/src/server.ts b/packages/node-api/src/server.ts index eb122869e..1f8127e8c 100644 --- a/packages/node-api/src/server.ts +++ b/packages/node-api/src/server.ts @@ -150,9 +150,10 @@ export async function initServer( }); } - process.on('SIGINT', handleShutdownGracefully); - process.on('SIGTERM', handleShutdownGracefully); - process.on('SIGHUP', handleShutdownGracefully); + for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) { + // Use once() so that receiving double signals exit the app. + process.once(signal, handleShutdownGracefully); + } }); }