diff options
author | 2023-10-09 20:47:38 +0200 | |
---|---|---|
committer | 2023-10-09 11:47:38 -0700 | |
commit | a9e1792607fea89944526ed5478a3a82db2932eb (patch) | |
tree | 8a0248b8d1f68ff3f2bd60eaebd825ea4107a080 /test/js/node/process/process.test.js | |
parent | 0965e6ddfd48b2e0e44c2efce7d9fc24115ef63e (diff) | |
download | bun-a9e1792607fea89944526ed5478a3a82db2932eb.tar.gz bun-a9e1792607fea89944526ed5478a3a82db2932eb.tar.zst bun-a9e1792607fea89944526ed5478a3a82db2932eb.zip |
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
Diffstat (limited to 'test/js/node/process/process.test.js')
-rw-r--r-- | test/js/node/process/process.test.js | 9 |
1 files changed, 9 insertions, 0 deletions
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")], |