Skip to content

Commit d4c1635

Browse files
committed
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.
1 parent 95ed40a commit d4c1635

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Sources/VirtualTerminal/Platform/POSIXTerminal.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,13 @@ internal final actor POSIXTerminal: VTTerminal {
279279
/// - Other VT100/ANSI control sequences
280280
public func write(_ string: String) {
281281
#if GNU
282-
_ = Glibc.write(self.hOut, string, string.utf8.count)
282+
let pfnWrite = Glibc.write
283+
#elseif os(macOS)
284+
let pfnWrite = Darwin.write
283285
#else
284-
_ = unistd.write(self.hOut, string, string.utf8.count)
286+
let pfnWrite = unistd.write
285287
#endif
288+
_ = pfnWrite(self.hOut, string, string.utf8.count)
286289
}
287290
}
288291

0 commit comments

Comments
 (0)