mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
35 lines
864 B
TypeScript
35 lines
864 B
TypeScript
import { expect, test } from "bun:test";
|
|
import { bunEnv, bunExe, isWindows, tempDirWithFiles } from "harness";
|
|
|
|
test.skipIf(isWindows)("verify that we forward SIGINT from parent to child in bun run", () => {
|
|
const dir = tempDirWithFiles("ctrlc", {
|
|
"index.js": `
|
|
let count = 0;
|
|
process.exitCode = 1;
|
|
process.once("SIGINT", () => {
|
|
process.kill(process.pid, "SIGKILL");
|
|
});
|
|
setTimeout(() => {}, 999999)
|
|
process.kill(process.ppid, "SIGINT");
|
|
`,
|
|
"package.json": `
|
|
{
|
|
"name": "ctrlc",
|
|
"scripts": {
|
|
"start": "${bunExe()} index.js"
|
|
}
|
|
}
|
|
`,
|
|
});
|
|
|
|
const result = Bun.spawnSync({
|
|
cmd: [bunExe(), "start"],
|
|
cwd: dir,
|
|
env: bunEnv,
|
|
stdout: "inherit",
|
|
stderr: "inherit",
|
|
});
|
|
expect(result.exitCode).toBe(null);
|
|
expect(result.signalCode).toBe("SIGKILL");
|
|
});
|