@@ -12,7 +12,7 @@ import eXtenderZ
1212import SignalHandling
1313import StreamReader
1414
15- #if os(Linux )
15+ #if !canImport(Darwin )
1616import CGNUSourceExports
1717#endif
1818import CMacroExports
@@ -494,13 +494,13 @@ public struct ProcessInvocation : AsyncSequence {
494494 p. standardError = FileHandle ( fileDescriptor: fdForWriting. rawValue, closeOnDealloc: false )
495495 }
496496
497- #if !os(Linux )
497+ #if canImport(Darwin )
498498 let platformSpecificInfo : Void = ( )
499499#else
500500 var platformSpecificInfo = StreamReadPlatformSpecificInfo ( )
501501#endif
502502
503- #if os(Linux )
503+ #if !canImport(Darwin )
504504 for fd in outputFileDescriptors {
505505 /* Let’s see if the fd is a master pt or not.
506506 * This is needed to detect EOF properly and not throw an error when reading from a master pt (see handleProcessOutput for more info). */
@@ -603,7 +603,7 @@ public struct ProcessInvocation : AsyncSequence {
603603 let sv = UnsafeMutablePointer< CInt> . allocate( capacity: 2 )
604604 sv. initialize ( repeating: - 1 , count: 2 )
605605 defer { sv. deallocate ( ) }
606- #if !os(Linux )
606+ #if canImport(Darwin )
607607 let sockDgram = SOCK_DGRAM
608608#else
609609 let sockDgram = Int32 ( SOCK_DGRAM . rawValue)
@@ -838,7 +838,7 @@ public struct ProcessInvocation : AsyncSequence {
838838 MARK: - Private
839839 *************** */
840840
841- #if !os(Linux )
841+ #if canImport(Darwin )
842842 private typealias StreamReadPlatformSpecificInfo = Void
843843#else
844844 private struct StreamReadPlatformSpecificInfo {
@@ -905,7 +905,7 @@ public struct ProcessInvocation : AsyncSequence {
905905 ) {
906906 do {
907907 let toRead = Int ( Swift . min ( Swift . max ( estimatedBytesAvailable, 1 ) , UInt ( Int . max) ) )
908- #if !os(Linux )
908+ #if canImport(Darwin )
909909 /* We do not need to check the number of bytes actually read.
910910 * If EOF was reached (nothing was read),
911911 * the stream reader will remember it, and
@@ -1008,7 +1008,7 @@ public struct ProcessInvocation : AsyncSequence {
10081008 let buf = UnsafeMutableRawPointer . allocate ( byteCount: SPI_CMSG_SPACE ( sizeOfFd) , alignment: MemoryLayout< cmsghdr> . alignment)
10091009 defer { buf. deallocate ( ) }
10101010
1011- #if !os(Linux )
1011+ #if canImport(Darwin )
10121012 msg. msg_control = UnsafeMutableRawPointer ( buf)
10131013 msg. msg_controllen = socklen_t ( SPI_CMSG_SPACE ( sizeOfFd) )
10141014#else
@@ -1020,15 +1020,15 @@ public struct ProcessInvocation : AsyncSequence {
10201020 throw Err . internalError ( " CMSG_FIRSTHDR returned nil. " )
10211021 }
10221022
1023- #if !os(Linux )
1023+ #if canImport(Darwin )
10241024 cmsg. pointee. cmsg_type = SCM_RIGHTS
10251025 cmsg. pointee. cmsg_level = SOL_SOCKET
10261026#else
10271027 cmsg. pointee. cmsg_type = Int32 ( SCM_RIGHTS)
10281028 cmsg. pointee. cmsg_level = SOL_SOCKET
10291029#endif
10301030
1031- #if !os(Linux )
1031+ #if canImport(Darwin )
10321032 cmsg. pointee. cmsg_len = socklen_t ( SPI_CMSG_LEN ( sizeOfFd) )
10331033#else
10341034 cmsg. pointee. cmsg_len = Int ( SPI_CMSG_LEN ( sizeOfFd) )
0 commit comments