From 43fd5409606c67eac9479dbbd695cd44f50f5c5b Mon Sep 17 00:00:00 2001 From: kkHAIKE Date: Fri, 9 May 2025 11:24:16 +0800 Subject: [PATCH] BugFix: gracefully clean up pipe objects to fix high CPUe CLOSE #917 --- WhiskyKit/Sources/WhiskyKit/Extensions/Process+Extensions.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WhiskyKit/Sources/WhiskyKit/Extensions/Process+Extensions.swift b/WhiskyKit/Sources/WhiskyKit/Extensions/Process+Extensions.swift index 31a0947b5..bdaab71d0 100644 --- a/WhiskyKit/Sources/WhiskyKit/Extensions/Process+Extensions.swift +++ b/WhiskyKit/Sources/WhiskyKit/Extensions/Process+Extensions.swift @@ -75,6 +75,8 @@ public extension Process { terminationHandler = { (process: Process) in do { + pipe.fileHandleForReading.readabilityHandler = nil + errorPipe.fileHandleForReading.readabilityHandler = nil _ = try pipe.fileHandleForReading.readToEnd() _ = try errorPipe.fileHandleForReading.readToEnd() try fileHandle?.close()