@@ -453,10 +453,9 @@ private extension Process {
453
453
self . environment = environment
454
454
}
455
455
456
- let outputPipe = SocketPair ( )
457
- let errorPipe = SocketPair ( )
458
- self . standardOutput = outputPipe. fileHandleForWriting
459
- self . standardError = errorPipe. fileHandleForWriting
456
+ let outputPipe = Pipe ( ) , errorPipe = Pipe ( )
457
+ self . standardOutput = outputPipe
458
+ self . standardError = errorPipe
460
459
461
460
// Because FileHandle's readabilityHandler might be called from a
462
461
// different queue from the calling queue, avoid data races by
@@ -655,30 +654,3 @@ private extension String {
655
654
self = appending ( arguments: arguments)
656
655
}
657
656
}
658
-
659
-
660
- final class SocketPair {
661
- let fileHandleForReading : FileHandle
662
- let fileHandleForWriting : FileHandle
663
-
664
- init ( ) {
665
- let fds = UnsafeMutablePointer< Int32> . allocate( capacity: 2 )
666
- defer { fds. deallocate ( ) }
667
-
668
- #if os(macOS)
669
- let ret = socketpair ( AF_UNIX, SOCK_STREAM, 0 , fds)
670
- #else
671
- let ret = socketpair ( AF_UNIX, Int32 ( SOCK_STREAM . rawValue) , 0 , fds)
672
- #endif
673
- switch ( ret, errno) {
674
- case ( 0 , _) :
675
- self . fileHandleForReading = FileHandle ( fileDescriptor: fds. pointee, closeOnDealloc: true )
676
- self . fileHandleForWriting = FileHandle ( fileDescriptor: fds. successor ( ) . pointee, closeOnDealloc: true )
677
- case ( - 1 , EMFILE) , ( - 1 , ENFILE) :
678
- self . fileHandleForReading = FileHandle ( fileDescriptor: - 1 , closeOnDealloc: false )
679
- self . fileHandleForWriting = FileHandle ( fileDescriptor: - 1 , closeOnDealloc: false )
680
- default :
681
- fatalError ( " Error calling socketpair(): \( errno) " )
682
- }
683
- }
684
- }
0 commit comments