From a9e1792607fea89944526ed5478a3a82db2932eb Mon Sep 17 00:00:00 2001 From: Liz Date: Mon, 9 Oct 2023 20:47:38 +0200 Subject: fix: support uint8 exit code range (#6303) The exit code support is between 0-255 and not only in the signed positive range (0-127). Node.js does not seam to throw on a bigger integer and just wraps around, but throwing a error is a good approach and makes the behaviour more defined. This allows the range to be 0-255 Fixes: https://github.com/oven-sh/bun/issues/6284 --- test/js/node/process/process.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/js/node/process/process.test.js') 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")], -- cgit v1.2.3