From 5c685f9b3e97649d478288a9082dfd482776f8d5 Mon Sep 17 00:00:00 2001 From: mochalins <117967760+mochalins@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:49:09 +0900 Subject: [PATCH] fix: flush for macos --- src/backend/posix.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/posix.zig b/src/backend/posix.zig index 36c32f1..622ed4a 100644 --- a/src/backend/posix.zig +++ b/src/backend/posix.zig @@ -1,6 +1,9 @@ const builtin = @import("builtin"); const std = @import("std"); const serialport = @import("../serialport.zig"); +const c = @cImport({ + @cInclude("termios.h"); +}); pub const Port = struct { name: []const u8, @@ -141,7 +144,9 @@ fn tcflush(fd: std.posix.fd_t, action: TCFLUSH) !void { @intFromEnum(action), ); }, - .macos => try std.c.tcflush(fd, @intFromEnum(action)), + .macos => b: { + break :b try c.tcflush(fd, @intFromEnum(action)); + }, else => @compileError("tcflush unimplemented on this OS"), }; return switch (std.posix.errno(result)) {