From 5315dd25e03132f16ce266904c5442040a6d97f3 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 59df3d1ceb328d..4b912accaff6eb 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -110,6 +110,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] &&