Skip to content

Commit e343eb3

Browse files
committed
wrap attach in Linux-only if statement
1 parent a80d053 commit e343eb3

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

vminitd/Sources/vminitd/TerminalIO.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ final class TerminalIO: ManagedProcess.IO & Sendable {
5555
func start() throws {}
5656

5757
func attach(pid: Int32, fd: Int32) throws {
58+
#if os(linux)
5859
let containerFd = Glibc.syscall(Int(SYS_pidfd_open), pid, 0)
5960
guard containerFd != -1 else {
6061
throw POSIXError.fromErrno()
@@ -72,6 +73,9 @@ final class TerminalIO: ManagedProcess.IO & Sendable {
7273
let fdDup = Int32(hostFd)
7374
self.parent = try Terminal(descriptor: fdDup, setInitState: false)
7475
try setupRelays(fd: fdDup)
76+
#else
77+
fatalError("attach not supported on platform")
78+
#endif
7579
}
7680

7781
private func setupRelays(fd: Int32) throws {

0 commit comments

Comments
 (0)