mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 17:01:53 +03:00
fix(macos): drain subprocess pipes before wait (#1081)
Thanks @thesash. Co-authored-by: Sash Catanzarite <sashcatanzarite@Sash-MacBook-Pro-14in-3.local>
This commit is contained in:
@@ -17,8 +17,11 @@ enum Launchctl {
|
||||
process.standardError = pipe
|
||||
do {
|
||||
try process.run()
|
||||
process.waitUntilExit()
|
||||
// Read pipe output BEFORE waitUntilExit to avoid deadlock.
|
||||
// If the process writes enough to fill the pipe buffer (~64KB),
|
||||
// it will block until someone reads. Reading first prevents this.
|
||||
let data = pipe.fileHandleForReading.readToEndSafely()
|
||||
process.waitUntilExit()
|
||||
let output = String(data: data, encoding: .utf8) ?? ""
|
||||
return Result(status: process.terminationStatus, output: output)
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user