Skip to content

Commit

Permalink
fix: Windows poll does not return ProcessNotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
giann committed Feb 2, 2025
1 parent 0c57419 commit 3931040
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/lib/buzz_io.zig
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,10 @@ pub export fn PollerPoll(ctx: *api.NativeCtx) callconv(.c) c_int {
) * 1_000_000;

const got_something = poller.pollTimeout(timeout) catch |err| {
handlePollError(ctx, err);
if (builtin.os.tag != .windows)
handlePollError(ctx, err)
else
handleWindowsPollError(ctx, err);

return -1;
};
Expand Down Expand Up @@ -578,6 +581,16 @@ fn handlePollError(ctx: *api.NativeCtx, err: anytype) void {
}
}

fn handleWindowsPollError(ctx: *api.NativeCtx, err: anytype) void {
switch (err) {
error.Unexpected => ctx.vm.pushError("errors.UnexpectedError", null),
error.OutOfMemory => {
ctx.vm.bz_panic("Out of memory", "Out of memory".len);
unreachable;
},
}
}

pub export fn runFile(ctx: *api.NativeCtx) callconv(.c) c_int {
// Read file
var len: usize = 0;
Expand Down

0 comments on commit 3931040

Please sign in to comment.