Skip to content

Commit 82930d5

Browse files
committed
fixup: remove the range restriction
Signed-off-by: Daeyeon Jeong [email protected]
1 parent dcc27ac commit 82930d5

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

doc/api/process.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@ that started the Node.js process. Symbolic links, if any, are resolved.
17161716
added: v0.1.13
17171717
-->
17181718
1719-
* `code` {integer} The exit code in the range `0``255`. **Default:** `0`.
1719+
* `code` {integer} The exit code. **Default:** `0`.
17201720
17211721
The `process.exit()` method instructs Node.js to terminate the process
17221722
synchronously with an exit status of `code`. If `code` is omitted, exit uses

lib/internal/process/per_thread.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function wrapProcessMethods(binding) {
183183
process.off('exit', handleProcessExit);
184184

185185
if (code !== null && code !== undefined) {
186-
validateInteger(code, 'code', 0, 255);
186+
validateInteger(code, 'code');
187187
process.exitCode = code;
188188
}
189189

test/parallel/test-process-exit-code-validation.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,14 @@ require('../common');
44
const { strictEqual } = require('node:assert');
55

66
const isParent = () => process.argv[2] === undefined;
7-
const invalid_type_samples = ['', '0', {}, [], true, false];
8-
const out_of_range_samples = [-1, 256];
9-
const args = [...invalid_type_samples, ...out_of_range_samples];
7+
const args = ['', '0', {}, [], true, false];
108

119
if (isParent()) {
1210
const { spawn } = require('node:child_process');
1311

1412
// Test the samples.
1513
strictEqual(
16-
invalid_type_samples.every(
17-
(v) => typeof v !== 'number' && v !== null && v !== undefined,
18-
),
19-
true,
20-
);
21-
22-
strictEqual(
23-
out_of_range_samples.every(
24-
(v) => typeof v == 'number' && (v < 0 || v > 255),
25-
),
14+
args.every((v) => typeof v !== 'number' && v !== null && v !== undefined),
2615
true,
2716
);
2817

0 commit comments

Comments
 (0)