@@ -76,7 +76,7 @@ public struct ProcessStageOptions: Sendable {
76
76
public struct PipeStage : Sendable {
77
77
enum StageType : Sendable {
78
78
case process( configuration: Configuration , options: ProcessStageOptions )
79
- case swiftFunction( @Sendable ( AsyncBufferSequence, StandardInputWriter, StandardInputWriter) async throws -> Int32 )
79
+ case swiftFunction( @Sendable ( AsyncBufferSequence, StandardInputWriter, StandardInputWriter) async throws -> UInt32 )
80
80
}
81
81
82
82
let stageType : StageType
@@ -110,7 +110,7 @@ public struct PipeStage: Sendable {
110
110
111
111
/// Create a PipeStage from a Swift function
112
112
public init (
113
- swiftFunction: @escaping @Sendable ( AsyncBufferSequence, StandardInputWriter, StandardInputWriter) async throws -> Int32
113
+ swiftFunction: @escaping @Sendable ( AsyncBufferSequence, StandardInputWriter, StandardInputWriter) async throws -> UInt32
114
114
) {
115
115
self . stageType = . swiftFunction( swiftFunction)
116
116
}
@@ -243,7 +243,7 @@ extension PipeConfiguration where Input == NoInput, Output == DiscardedOutput, E
243
243
/// Initialize a PipeConfiguration with a Swift function
244
244
/// I/O defaults to discarded until finalized with `finally`
245
245
public init (
246
- swiftFunction: @escaping @Sendable ( AsyncBufferSequence, StandardInputWriter, StandardInputWriter) async throws -> Int32
246
+ swiftFunction: @escaping @Sendable ( AsyncBufferSequence, StandardInputWriter, StandardInputWriter) async throws -> UInt32
247
247
) {
248
248
self . stages = [ PipeStage ( swiftFunction: swiftFunction) ]
249
249
self . input = NoInput ( )
@@ -524,7 +524,7 @@ extension PipeConfiguration {
524
524
let errorWriteFileDescriptor = createIODescriptor ( from: sharedErrorPipe. writeEnd, closeWhenDone: false )
525
525
var errorWriteEnd : IOChannel ? = errorWriteFileDescriptor. createIOChannel ( )
526
526
527
- let result = try await withThrowingTaskGroup ( of: Int32 . self) { group in
527
+ let result = try await withThrowingTaskGroup ( of: UInt32 . self) { group in
528
528
let inputReadEnd = inputReadEnd. take ( ) !
529
529
let outputWriteEnd = outputWriteEnd. take ( ) !
530
530
let errorWriteEnd = errorWriteEnd. take ( ) !
@@ -560,12 +560,18 @@ extension PipeConfiguration {
560
560
return 0
561
561
}
562
562
563
+ #if canImport(WinSD)
564
+ let terminationStatus : TerminationStatus = . exited( result)
565
+ #else
566
+ let terminationStatus : TerminationStatus = . exited( Int32 ( result) )
567
+ #endif
568
+
563
569
return PipelineTaskResult . success (
564
570
0 ,
565
571
SendableCollectedResult (
566
572
CollectedResult < FileDescriptorOutput , DiscardedOutput > (
567
573
processIdentifier: currentProcessIdentifier ( ) ,
568
- terminationStatus: . exited ( result ) ,
574
+ terminationStatus: terminationStatus ,
569
575
standardOutput: ( ) ,
570
576
standardError: ( )
571
577
) ) )
@@ -962,7 +968,7 @@ public func pipe(
962
968
963
969
/// Create a single-stage pipeline with a Swift function
964
970
public func pipe(
965
- swiftFunction: @escaping @Sendable ( AsyncBufferSequence, StandardInputWriter, StandardInputWriter) async throws -> Int32
971
+ swiftFunction: @escaping @Sendable ( AsyncBufferSequence, StandardInputWriter, StandardInputWriter) async throws -> UInt32
966
972
) -> [ PipeStage ] {
967
973
return [ PipeStage ( swiftFunction: swiftFunction) ]
968
974
}
@@ -997,7 +1003,7 @@ public func | (
997
1003
/// Pipe operator for stage arrays with Swift function
998
1004
public func | (
999
1005
left: [ PipeStage ] ,
1000
- right: @escaping @Sendable ( AsyncBufferSequence, StandardInputWriter, StandardInputWriter) async throws -> Int32
1006
+ right: @escaping @Sendable ( AsyncBufferSequence, StandardInputWriter, StandardInputWriter) async throws -> UInt32
1001
1007
) -> [ PipeStage ] {
1002
1008
return left + [ PipeStage ( swiftFunction: right) ]
1003
1009
}
0 commit comments