Skip to content

process: fix `process.exit()` behavior when passing `null` or `undefined`

Refs: https://github.com/nodejs/node/issues/45683 (This fixes one of the two issues mentioned.)

The process should exit with code 2 in the following examples to fix the breaking.

process.exitCode = 2;
process.exit(undefined);

// $ echo $?
// 2
process.exitCode = 2;
process.exit(null);

// $ echo $?
// 2

This also updates the descriptions since the following behaviors may confuse users :

  • passing null or undefined to 'process.exit()' is not applied to the exit code.
  • setting null or undefined to 'process.exitCode' is applied to the exit code.

Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com

Merge request reports

Loading