@@ -291,6 +291,14 @@ private func createIODescriptor(from fd: FileDescriptor, closeWhenDone: Bool) ->
291291 #endif
292292}
293293
294+ private func createTerminationStatus( _ exitCode: UInt32 ) -> TerminationStatus {
295+ #if canImport(WinSD)
296+ return . exited( exitCode)
297+ #else
298+ return . exited( Int32 ( exitCode) )
299+ #endif
300+ }
301+
294302// MARK: - Internal Functions
295303
296304extension PipeConfiguration {
@@ -560,18 +568,12 @@ extension PipeConfiguration {
560568 return 0
561569 }
562570
563- #if canImport(WinSD)
564- let terminationStatus : TerminationStatus = . exited( result)
565- #else
566- let terminationStatus : TerminationStatus = . exited( Int32 ( result) )
567- #endif
568-
569571 return PipelineTaskResult . success (
570572 0 ,
571573 SendableCollectedResult (
572574 CollectedResult < FileDescriptorOutput , DiscardedOutput > (
573575 processIdentifier: currentProcessIdentifier ( ) ,
574- terminationStatus: terminationStatus ,
576+ terminationStatus: createTerminationStatus ( result ) ,
575577 standardOutput: ( ) ,
576578 standardError: ( )
577579 ) ) )
@@ -660,7 +662,7 @@ extension PipeConfiguration {
660662 let errorWriteFileDescriptor : IODescriptor = createIODescriptor ( from: sharedErrorPipe. writeEnd, closeWhenDone: false )
661663 var errorWriteEnd : IOChannel ? = errorWriteFileDescriptor. createIOChannel ( )
662664
663- let result = try await withThrowingTaskGroup ( of: Int32 . self) { group in
665+ let result = try await withThrowingTaskGroup ( of: UInt32 . self) { group in
664666 // FIXME figure out how to propagate a preferred buffer size to this sequence
665667 let inSequence = AsyncBufferSequence ( diskIO: inputReadEnd. take ( ) !. consumeIOChannel ( ) , preferredBufferSize: nil )
666668 let outWriter = StandardInputWriter ( diskIO: outputWriteEnd. take ( ) !)
@@ -684,7 +686,7 @@ extension PipeConfiguration {
684686 SendableCollectedResult (
685687 CollectedResult < FileDescriptorOutput , DiscardedOutput > (
686688 processIdentifier: currentProcessIdentifier ( ) ,
687- terminationStatus: . exited ( result) ,
689+ terminationStatus: createTerminationStatus ( result) ,
688690 standardOutput: ( ) ,
689691 standardError: ( )
690692 ) ) )
@@ -821,7 +823,7 @@ extension PipeConfiguration {
821823 let errorWriteFileDescriptor = createIODescriptor ( from: sharedErrorPipe. writeEnd, closeWhenDone: false )
822824 var errorWriteEnd : IOChannel ? = errorWriteFileDescriptor. createIOChannel ( )
823825
824- let result : ( Int32 , Output . OutputType ) = try await withThrowingTaskGroup ( of: ( Int32 , OutputCapturingState < Output . OutputType , ( ) > ? ) . self) { group in
826+ let result : ( UInt32 , Output . OutputType ) = try await withThrowingTaskGroup ( of: ( UInt32 , OutputCapturingState < Output . OutputType , ( ) > ? ) . self) { group in
825827 // FIXME figure out how to propagate a preferred buffer size to this sequence
826828 let inSequence = AsyncBufferSequence ( diskIO: inputReadEnd. take ( ) !. consumeIOChannel ( ) , preferredBufferSize: nil )
827829 let outWriter = StandardInputWriter ( diskIO: outputWriteEnd. take ( ) !)
@@ -842,7 +844,7 @@ extension PipeConfiguration {
842844 return ( retVal, . none)
843845 }
844846
845- var exitCode : Int32 = 0
847+ var exitCode : UInt32 = 0
846848 var output : Output . OutputType ? = nil
847849 for try await r in group {
848850 if r. 0 != 0 {
@@ -862,7 +864,7 @@ extension PipeConfiguration {
862864 SendableCollectedResult (
863865 CollectedResult < Output , DiscardedOutput > (
864866 processIdentifier: currentProcessIdentifier ( ) ,
865- terminationStatus: . exited ( result. 0 ) ,
867+ terminationStatus: createTerminationStatus ( result. 0 ) ,
866868 standardOutput: result. 1 ,
867869 standardError: ( )
868870 ) ) )
0 commit comments