From f3b92511684822461a8eb730fee5a071b14b3775 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Tue, 30 Dec 2025 16:43:32 -0800 Subject: [PATCH] Platform: use a pfn to `write` and reference `Darwin.write` The `write` method is not properly exposed through the `unistd` module on Darwin. As a result, we need to special case macOS and pull it from the `Darwin` module. --- Sources/VirtualTerminal/Platform/POSIXTerminal.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/VirtualTerminal/Platform/POSIXTerminal.swift b/Sources/VirtualTerminal/Platform/POSIXTerminal.swift index b061b74..a154b36 100644 --- a/Sources/VirtualTerminal/Platform/POSIXTerminal.swift +++ b/Sources/VirtualTerminal/Platform/POSIXTerminal.swift @@ -279,10 +279,13 @@ internal final actor POSIXTerminal: VTTerminal { /// - Other VT100/ANSI control sequences public func write(_ string: String) { #if GNU - _ = Glibc.write(self.hOut, string, string.utf8.count) + let pfnWrite = Glibc.write +#elseif os(macOS) + let pfnWrite = Darwin.write #else - _ = unistd.write(self.hOut, string, string.utf8.count) + let pfnWrite = unistd.write #endif + _ = pfnWrite(self.hOut, string, string.utf8.count) } }