From 344d24ca2a47a1d9fd52f098933e2b6678aef2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Fri, 6 Mar 2020 17:14:48 +0100 Subject: [PATCH] Prevents exiting the process on sigint through yarn-path (#7957) --- src/cli/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cli/index.js b/src/cli/index.js index 5a66fc03a4..c449d7758a 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -629,6 +629,11 @@ async function start(): Promise { const opts = {stdio: 'inherit', env: Object.assign({}, process.env, {YARN_IGNORE_PATH: 1})}; let exitCode = 0; + process.on(`SIGINT`, () => { + // We don't want SIGINT to kill our process; we want it to kill the + // innermost process, whose end will cause our own to exit. + }); + try { if (yarnPath.endsWith(`.js`)) { exitCode = await spawnp(process.execPath, [yarnPath, ...argv], opts);