Mark all closures in the .stream outputRedirection of TSC as @Sendable

The closures aren’t guaranteed to be called on the same thread as the process was launched, which can cause assertion failure by the concurrency runtime.

rdar://142813605
This commit is contained in:
Alex Hoppen
2025-01-15 08:25:25 -08:00
parent 274726fec0
commit 7fffc04e50
3 changed files with 20 additions and 12 deletions

View File

@@ -655,8 +655,8 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem {
arguments: arguments,
workingDirectory: nil,
outputRedirection: .stream(
stdout: { stdoutHandler.handleDataFromPipe(Data($0)) },
stderr: { stderrHandler.handleDataFromPipe(Data($0)) }
stdout: { @Sendable bytes in stdoutHandler.handleDataFromPipe(Data(bytes)) },
stderr: { @Sendable bytes in stderrHandler.handleDataFromPipe(Data(bytes)) }
)
)
let exitStatus = result.exitStatus.exhaustivelySwitchable