mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 04:49:06 +00:00
fix windows kill on subprocess/process
This commit is contained in:
@@ -494,7 +494,10 @@ pub const Process = struct {
|
||||
switch (this.poller) {
|
||||
.uv => |*handle| {
|
||||
if (handle.kill(signal).toError(.kill)) |err| {
|
||||
return .{ .err = err };
|
||||
// if the process was already killed don't throw
|
||||
if (err.errno != @intFromEnum(bun.C.E.SRCH)) {
|
||||
return .{ .err = err };
|
||||
}
|
||||
}
|
||||
|
||||
return .{
|
||||
|
||||
@@ -575,6 +575,7 @@ pub const Subprocess = struct {
|
||||
switch (this.tryKill(sig)) {
|
||||
.result => {},
|
||||
.err => |err| {
|
||||
// EINVAL or ENOSYS means the signal is not supported in the current platform (most likely unsupported on windows)
|
||||
globalThis.throwValue(err.toJSC(globalThis));
|
||||
return .zero;
|
||||
},
|
||||
|
||||
@@ -975,7 +975,9 @@ pub const SignalCode = enum(u8) {
|
||||
SIGSYS = 31,
|
||||
_,
|
||||
|
||||
pub const default = if (Environment.isWindows) 1 else @intFromEnum(SignalCode.SIGTERM);
|
||||
// The `subprocess.kill()` method sends a signal to the child process. If no
|
||||
// argument is given, the process will be sent the 'SIGTERM' signal.
|
||||
pub const default = @intFromEnum(SignalCode.SIGTERM);
|
||||
pub const Map = ComptimeEnumMap(SignalCode);
|
||||
pub fn name(value: SignalCode) ?[]const u8 {
|
||||
if (@intFromEnum(value) <= @intFromEnum(SignalCode.SIGSYS)) {
|
||||
|
||||
Reference in New Issue
Block a user