refactor(macos): centralize process pipe draining

This commit is contained in:
Peter Steinberger committed 2026-01-17 08:53:10 +00:00
1 parent 1002c74d9c
commit 869ef0c5ba
7 files changed
+20 -24

No files matched your search

@@ -0,0 +1,11 @@
import Foundation
extension Process {
/// Runs the process and drains the given pipe before waiting to avoid blocking on full buffers.
func runAndReadToEnd(from pipe: Pipe) throws -> Data {
try self.run()
let data = pipe.fileHandleForReading.readToEndSafely()
self.waitUntilExit()
return data
}
}