@@ -291,6 +291,14 @@ private func createIODescriptor(from fd: FileDescriptor, closeWhenDone: Bool) ->
291
291
#endif
292
292
}
293
293
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
+
294
302
// MARK: - Internal Functions
295
303
296
304
extension PipeConfiguration {
@@ -560,18 +568,12 @@ extension PipeConfiguration {
560
568
return 0
561
569
}
562
570
563
- #if canImport(WinSD)
564
- let terminationStatus : TerminationStatus = . exited( result)
565
- #else
566
- let terminationStatus : TerminationStatus = . exited( Int32 ( result) )
567
- #endif
568
-
569
571
return PipelineTaskResult . success (
570
572
0 ,
571
573
SendableCollectedResult (
572
574
CollectedResult < FileDescriptorOutput , DiscardedOutput > (
573
575
processIdentifier: currentProcessIdentifier ( ) ,
574
- terminationStatus: terminationStatus ,
576
+ terminationStatus: createTerminationStatus ( result ) ,
575
577
standardOutput: ( ) ,
576
578
standardError: ( )
577
579
) ) )
@@ -660,7 +662,7 @@ extension PipeConfiguration {
660
662
let errorWriteFileDescriptor : IODescriptor = createIODescriptor ( from: sharedErrorPipe. writeEnd, closeWhenDone: false )
661
663
var errorWriteEnd : IOChannel ? = errorWriteFileDescriptor. createIOChannel ( )
662
664
663
- let result = try await withThrowingTaskGroup ( of: Int32 . self) { group in
665
+ let result = try await withThrowingTaskGroup ( of: UInt32 . self) { group in
664
666
// FIXME figure out how to propagate a preferred buffer size to this sequence
665
667
let inSequence = AsyncBufferSequence ( diskIO: inputReadEnd. take ( ) !. consumeIOChannel ( ) , preferredBufferSize: nil )
666
668
let outWriter = StandardInputWriter ( diskIO: outputWriteEnd. take ( ) !)
@@ -684,7 +686,7 @@ extension PipeConfiguration {
684
686
SendableCollectedResult (
685
687
CollectedResult < FileDescriptorOutput , DiscardedOutput > (
686
688
processIdentifier: currentProcessIdentifier ( ) ,
687
- terminationStatus: . exited ( result) ,
689
+ terminationStatus: createTerminationStatus ( result) ,
688
690
standardOutput: ( ) ,
689
691
standardError: ( )
690
692
) ) )
@@ -821,7 +823,7 @@ extension PipeConfiguration {
821
823
let errorWriteFileDescriptor = createIODescriptor ( from: sharedErrorPipe. writeEnd, closeWhenDone: false )
822
824
var errorWriteEnd : IOChannel ? = errorWriteFileDescriptor. createIOChannel ( )
823
825
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
825
827
// FIXME figure out how to propagate a preferred buffer size to this sequence
826
828
let inSequence = AsyncBufferSequence ( diskIO: inputReadEnd. take ( ) !. consumeIOChannel ( ) , preferredBufferSize: nil )
827
829
let outWriter = StandardInputWriter ( diskIO: outputWriteEnd. take ( ) !)
@@ -842,7 +844,7 @@ extension PipeConfiguration {
842
844
return ( retVal, . none)
843
845
}
844
846
845
- var exitCode : Int32 = 0
847
+ var exitCode : UInt32 = 0
846
848
var output : Output . OutputType ? = nil
847
849
for try await r in group {
848
850
if r. 0 != 0 {
@@ -862,7 +864,7 @@ extension PipeConfiguration {
862
864
SendableCollectedResult (
863
865
CollectedResult < Output , DiscardedOutput > (
864
866
processIdentifier: currentProcessIdentifier ( ) ,
865
- terminationStatus: . exited ( result. 0 ) ,
867
+ terminationStatus: createTerminationStatus ( result. 0 ) ,
866
868
standardOutput: result. 1 ,
867
869
standardError: ( )
868
870
) ) )
0 commit comments