diff options
Diffstat (limited to 'test/bun.js/spawn.test.ts')
-rw-r--r-- | test/bun.js/spawn.test.ts | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/test/bun.js/spawn.test.ts b/test/bun.js/spawn.test.ts index 1b62542cf..24cf08e35 100644 --- a/test/bun.js/spawn.test.ts +++ b/test/bun.js/spawn.test.ts @@ -31,10 +31,10 @@ for (let [gcTick, label] of [ it("check exit code", async () => { const { exitCode: exitCode1 } = spawnSync({ - cmd: ["ls"] + cmd: ["ls"], }); const { exitCode: exitCode2 } = spawnSync({ - cmd: ["false"] + cmd: ["false"], }); expect(exitCode1).toBe(0); expect(exitCode2).toBe(1); @@ -86,7 +86,7 @@ for (let [gcTick, label] of [ cmd: ["ls"], }).exited; const exitCode2 = await spawn({ - cmd: ["false"] + cmd: ["false"], }).exited; expect(exitCode1).toBe(0); expect(exitCode2).toBe(1); @@ -162,6 +162,28 @@ for (let [gcTick, label] of [ expect(text).toBe(hugeString); }); + it("kill(1) works", async () => { + const process = spawn({ + cmd: ["bash", "-c", "sleep 1000"], + stdout: "pipe", + }); + gcTick(); + const prom = process.exited; + process.kill(1); + await prom; + }); + + it("kill() works", async () => { + const process = spawn({ + cmd: ["bash", "-c", "sleep 1000"], + stdout: "pipe", + }); + gcTick(); + const prom = process.exited; + process.kill(); + await prom; + }); + it("stdin can be read and stdout can be written", async () => { const proc = spawn({ cmd: ["bash", import.meta.dir + "/bash-echo.sh"], |