diff options
-rw-r--r-- | src/bun.js/bindings/Process.cpp | 4 | ||||
-rw-r--r-- | test/js/node/process/process.test.js | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/bun.js/bindings/Process.cpp b/src/bun.js/bindings/Process.cpp index 1caff9be9..fd194f547 100644 --- a/src/bun.js/bindings/Process.cpp +++ b/src/bun.js/bindings/Process.cpp @@ -749,8 +749,8 @@ JSC_DEFINE_CUSTOM_SETTER(setProcessExitCode, (JSC::JSGlobalObject * lexicalGloba int exitCodeInt = exitCode.toInt32(lexicalGlobalObject); RETURN_IF_EXCEPTION(throwScope, false); - if (exitCodeInt < 0 || exitCodeInt > 127) { - throwRangeError(lexicalGlobalObject, throwScope, "exitCode must be between 0 and 127"_s); + if (exitCodeInt < 0 || exitCodeInt > 255) { + throwRangeError(lexicalGlobalObject, throwScope, "exitCode must be between 0 and 255"_s); return false; } diff --git a/test/js/node/process/process.test.js b/test/js/node/process/process.test.js index 4fb678dce..fd91fdef5 100644 --- a/test/js/node/process/process.test.js +++ b/test/js/node/process/process.test.js @@ -263,6 +263,15 @@ describe("process.exitCode", () => { }); }); +it("process exitCode range (#6284)", () => { + const { exitCode, stdout } = spawnSync({ + cmd: [bunExe(), join(import.meta.dir, "process-exitCode-fixture.js"), "255"], + env: bunEnv, + }); + expect(exitCode).toBe(255); + expect(stdout.toString().trim()).toBe("PASS"); +}); + it("process.exit", () => { const { exitCode, stdout } = spawnSync({ cmd: [bunExe(), join(import.meta.dir, "process-exit-fixture.js")], |