From aa2e86088cf5e0c4d4b2b1752f48de7bcc8e1d42 Mon Sep 17 00:00:00 2001 From: Alan Pazetto Date: Thu, 17 Oct 2024 01:20:17 -0300 Subject: [PATCH] fix(js): change verdaccio childProcess kill order (#28364) ## Current Behavior `@nx/js:verdaccio` current call `npm config` to setup npm scopes in global `.npmrc` file, which it's supposed to do. However, when process is killed (using terminal exit command or any other way), the process is killed and doesn't restore changed config. In my case I'm changing scope to my private scope (using `scopes` option), but after kill I need to restore manually. ## Expected Behavior When process be killed, restore all configs that was set. ## Related Issue(s) #28353 Fixes #28353 --- packages/js/src/executors/verdaccio/verdaccio.impl.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/js/src/executors/verdaccio/verdaccio.impl.ts b/packages/js/src/executors/verdaccio/verdaccio.impl.ts index 1af6e7887b3dc..bb1f2076fdb95 100644 --- a/packages/js/src/executors/verdaccio/verdaccio.impl.ts +++ b/packages/js/src/executors/verdaccio/verdaccio.impl.ts @@ -49,12 +49,12 @@ export async function verdaccioExecutor( options.location === 'none' ? [] : [setupNpm(options), setupYarn(options)]; const processExitListener = (signal?: number | NodeJS.Signals) => { - if (childProcess) { - childProcess.kill(signal); - } for (const fn of cleanupFunctions) { fn(); } + if (childProcess) { + childProcess.kill(signal); + } }; process.on('exit', processExitListener); process.on('SIGTERM', processExitListener);