diff options
author | 2022-10-23 00:41:56 +0800 | |
---|---|---|
committer | 2022-10-22 09:41:56 -0700 | |
commit | 55c42f166332b143649b5770ae9f9c48104c1ea0 (patch) | |
tree | 02d326f96f9bf1e46146bd85ee7edaf75ca30d73 /test/bun.js/spawn.test.ts | |
parent | 85808700c8a89f82cfce55330a2c8c592a5623d2 (diff) | |
download | bun-55c42f166332b143649b5770ae9f9c48104c1ea0.tar.gz bun-55c42f166332b143649b5770ae9f9c48104c1ea0.tar.zst bun-55c42f166332b143649b5770ae9f9c48104c1ea0.zip |
Fix spawn exitcode (#1371)
Diffstat (limited to 'test/bun.js/spawn.test.ts')
-rw-r--r-- | test/bun.js/spawn.test.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/bun.js/spawn.test.ts b/test/bun.js/spawn.test.ts index 9e4144024..1b62542cf 100644 --- a/test/bun.js/spawn.test.ts +++ b/test/bun.js/spawn.test.ts @@ -28,6 +28,17 @@ for (let [gcTick, label] of [ expect(stdout.toString()).toBe(hugeString); expect(stderr.byteLength).toBe(0); }); + + it("check exit code", async () => { + const { exitCode: exitCode1 } = spawnSync({ + cmd: ["ls"] + }); + const { exitCode: exitCode2 } = spawnSync({ + cmd: ["false"] + }); + expect(exitCode1).toBe(0); + expect(exitCode2).toBe(1); + }); }); describe("spawn", () => { @@ -70,6 +81,17 @@ for (let [gcTick, label] of [ expect(await Bun.file("/tmp/out.123.txt").text()).toBe(hugeString); }); + it("check exit code", async () => { + const exitCode1 = await spawn({ + cmd: ["ls"], + }).exited; + const exitCode2 = await spawn({ + cmd: ["false"] + }).exited; + expect(exitCode1).toBe(0); + expect(exitCode2).toBe(1); + }); + it("Blob works as stdin", async () => { rmSync("/tmp/out.123.txt", { force: true }); gcTick(); |