From b48a6cb3f907ce049ee1773b72694a442ee2648a Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sat, 26 Mar 2022 21:04:41 +0800 Subject: [PATCH] bootstrap: reset process._exit and process.exitCode in pre-execution PR-URL: https://github.com/nodejs/node/pull/42466 Reviewed-By: Darshan Sen Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Khaidi Chu Reviewed-By: Chengzhong Wu --- lib/internal/bootstrap/pre_execution.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js index 06cf9d54d68a81..1a458d2724d78a 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -108,6 +108,9 @@ function patchProcessObject(expandArgv1) { configurable: getOptionValue('--build-snapshot'), value: process.argv[0] }); + + process.exitCode = undefined; + process._exiting = false; process.argv[0] = process.execPath; if (expandArgv1 && process.argv[1] &&