diff options
Diffstat (limited to 'src/bun.js')
-rw-r--r-- | src/bun.js/api/bun.zig | 4 | ||||
-rw-r--r-- | src/bun.js/api/bun/spawn.zig | 31 |
2 files changed, 30 insertions, 5 deletions
diff --git a/src/bun.js/api/bun.zig b/src/bun.js/api/bun.zig index 58918b18b..d62b1e9b8 100644 --- a/src/bun.js/api/bun.zig +++ b/src/bun.js/api/bun.zig @@ -3921,7 +3921,7 @@ pub const Subprocess = struct { break :brk @intCast(std.os.fd_t, pid); } - const kernel = @import("analytics").GenerateHeader.GeneratePlatform.kernelVersion(); + const kernel = @import("../../analytics.zig").GenerateHeader.GeneratePlatform.kernelVersion(); // pidfd_nonblock only supported in 5.10+ const flags: u32 = if (kernel.orderWithoutTag(.{ .major = 5, .minor = 10, .patch = 0 }).compare(.gte)) @@ -3935,7 +3935,7 @@ pub const Subprocess = struct { ); switch (std.os.linux.getErrno(fd)) { - .SUCCESS => break :brk fd, + .SUCCESS => break :brk @intCast(std.os.fd_t, fd), else => |err| { globalThis.throwValue(JSC.Node.Syscall.Error.fromCode(err, .open).toJSC(globalThis)); var status: u32 = 0; diff --git a/src/bun.js/api/bun/spawn.zig b/src/bun.js/api/bun/spawn.zig index bbc5d4fac..58dac9e9f 100644 --- a/src/bun.js/api/bun/spawn.zig +++ b/src/bun.js/api/bun/spawn.zig @@ -2,7 +2,20 @@ const JSC = @import("javascript_core"); const bun = @import("../../../global.zig"); const string = bun.string; const std = @import("std"); -const system = std.os.system; + +fn _getSystem() type { + if (comptime bun.Environment.isLinux) { + return struct { + pub usingnamespace std.os.system; + pub usingnamespace bun.C.linux; + }; + } + + return std.os.system; +} + +const system = _getSystem(); + const Maybe = JSC.Node.Maybe; const fd_t = std.os.fd_t; @@ -33,7 +46,13 @@ pub const PosixSpawn = struct { } pub fn deinit(self: *Attr) void { - system.posix_spawnattr_destroy(&self.attr); + if (comptime bun.Environment.isMac) { + // https://github.com/ziglang/zig/issues/12964 + system.posix_spawnattr_destroy(&self.attr); + } else { + _ = system.posix_spawnattr_destroy(&self.attr); + } + self.* = undefined; } @@ -69,7 +88,13 @@ pub const PosixSpawn = struct { } pub fn deinit(self: *Actions) void { - system.posix_spawn_file_actions_destroy(&self.actions); + if (comptime bun.Environment.isMac) { + // https://github.com/ziglang/zig/issues/12964 + system.posix_spawn_file_actions_destroy(&self.actions); + } else { + _ = system.posix_spawn_file_actions_destroy(&self.actions); + } + self.* = undefined; } |