mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
fix(node:child_process): fix crash with ipc (#8319)
* make sure `onLongTimeout` doesn't happen * add `onLongTimeout` handler
This commit is contained in:
@@ -1925,6 +1925,7 @@ pub const Subprocess = struct {
|
||||
});
|
||||
return .zero;
|
||||
};
|
||||
socket.setTimeout(0);
|
||||
pipes_to_close.append(bun.default_allocator, bun.toFD(fds[1])) catch |err| return globalThis.handleError(err, "in posix_spawn");
|
||||
actions.dup2(bun.toFD(fds[1]), bun.toFD(3)) catch |err| return globalThis.handleError(err, "in posix_spawn");
|
||||
actions.close(bun.toFD(fds[1])) catch |err| return globalThis.handleError(err, "in posix_spawn");
|
||||
|
||||
@@ -299,6 +299,11 @@ pub fn NewIPCHandler(comptime Context: type) type {
|
||||
_: Socket,
|
||||
) void {}
|
||||
|
||||
pub fn onLongTimeout(
|
||||
_: *Context,
|
||||
_: Socket,
|
||||
) void {}
|
||||
|
||||
pub fn onConnectError(
|
||||
_: *anyopaque,
|
||||
_: Socket,
|
||||
|
||||
@@ -3076,6 +3076,7 @@ pub const VirtualMachine = struct {
|
||||
.ipc = undefined,
|
||||
};
|
||||
const socket = IPC.Socket.fromFd(context, fd, IPCInstance, instance, null) orelse @panic("Unable to start IPC");
|
||||
socket.setTimeout(0);
|
||||
instance.ipc = .{ .socket = socket };
|
||||
|
||||
const ptr = socket.ext(*IPCInstance);
|
||||
|
||||
Reference in New Issue
Block a user