Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.

Commit 245c388

Browse files
committed
BugFix: gracefully clean up pipe objects to fix high CPUe
CLOSE #917
1 parent fd5480a commit 245c388

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

WhiskyKit/Sources/WhiskyKit/Extensions/Process+Extensions.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,12 @@ public extension Process {
7575

7676
terminationHandler = { (process: Process) in
7777
do {
78+
pipe.fileHandleForReading.readabilityHandler = nil
79+
errorPipe.fileHandleForReading.readabilityHandler = nil
7880
_ = try pipe.fileHandleForReading.readToEnd()
81+
_ = try pipe.fileHandleForReading.close()
7982
_ = try errorPipe.fileHandleForReading.readToEnd()
83+
_ = try errorPipe.fileHandleForReading.close()
8084
try fileHandle?.close()
8185
} catch {
8286
Logger.wineKit.error("Error while clearing data: \(error)")

0 commit comments

Comments
 (0)