mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
fix(node:process): fix return value of process.kill (#6207)
This commit is contained in:
2
packages/bun-types/globals.d.ts
vendored
2
packages/bun-types/globals.d.ts
vendored
@@ -681,7 +681,7 @@ interface Process {
|
||||
*/
|
||||
setSourceMapsEnabled(enabled: boolean): void;
|
||||
|
||||
kill(pid: number, signal?: string | number): void;
|
||||
kill(pid: number, signal?: string | number): true;
|
||||
|
||||
on(event: "beforeExit", listener: BeforeExitListener): this;
|
||||
// on(event: "disconnect", listener: DisconnectListener): this;
|
||||
|
||||
@@ -1835,7 +1835,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionKill,
|
||||
return JSValue::encode(jsUndefined());
|
||||
}
|
||||
|
||||
return JSValue::encode(jsUndefined());
|
||||
return JSValue::encode(jsBoolean(true));
|
||||
}
|
||||
|
||||
extern "C" void Process__emitMessageEvent(Zig::GlobalObject* global, EncodedJSValue value)
|
||||
|
||||
@@ -407,7 +407,8 @@ describe("signal", () => {
|
||||
stdout: "pipe",
|
||||
});
|
||||
const prom = child.exited;
|
||||
process.kill(child.pid, "SIGTERM");
|
||||
const ret = process.kill(child.pid, "SIGTERM");
|
||||
expect(ret).toBe(true);
|
||||
await prom;
|
||||
expect(child.signalCode).toBe("SIGTERM");
|
||||
});
|
||||
@@ -418,7 +419,8 @@ describe("signal", () => {
|
||||
stdout: "pipe",
|
||||
});
|
||||
const prom = child.exited;
|
||||
process.kill(child.pid, 9);
|
||||
const ret = process.kill(child.pid, 9);
|
||||
expect(ret).toBe(true);
|
||||
await prom;
|
||||
expect(child.signalCode).toBe("SIGKILL");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user