Skip to content

Commit 8351f25

Browse files
committed
fix: no windows sigaction
1 parent 8525413 commit 8351f25

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main.zig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ pub fn main() !void {
5454
};
5555

5656
// handle SIGABRT (called by lua in Debug mode)
57-
const act: if (builtin.mode == .Debug) std.posix.Sigaction else void = if (builtin.mode == .Debug) .{
57+
const using_sigaction = builtin.mode == .Debug and builtin.os.tag != .windows;
58+
const act: if (using_sigaction) std.posix.Sigaction else void = if (using_sigaction) .{
5859
.handler = .{
5960
.handler = struct {
6061
fn handleAbrt(_: c_int) callconv(.C) noreturn {
@@ -70,7 +71,7 @@ pub fn main() !void {
7071
.mask = if (builtin.os.tag == .linux) std.posix.empty_sigset else 0,
7172
.flags = 0,
7273
};
73-
if (builtin.mode == .Debug) try std.posix.sigaction(std.posix.SIG.ABRT, &act, null);
74+
if (using_sigaction) try std.posix.sigaction(std.posix.SIG.ABRT, &act, null);
7475

7576
const l = try Lua.init(&allocator);
7677
defer l.close();

0 commit comments

Comments
 (0)