Process

process.exitCode

Sets the exit status used for natural termination. Unlike process.exit(), assigning the property does not immediately force the process to stop.

Formal Syntax & Structure

nodejs syntaxnodejs
process.exitCode = 1

Return Value

number | string | null | undefined

Integer code or integer string; undefined/null reset to default in the tested version.

Working Example

Example Snippetnodejs
process.exitCode = 1;
Node.js Reference