diff --git a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift index b511f0a443e27..f262ff39d7bac 100644 --- a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift +++ b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift @@ -45,7 +45,9 @@ func isExecutable(_ path: String) throws -> Bool { throw CodeSigningError.failedToCodeSign("Failed to determine if \(path) is an executable.") } - let outputData = outPipe.fileHandleForReading.readDataToEndOfFile() + let outputFileHandle = outPipe.fileHandleForReading + let outputData = outputFileHandle.readDataToEndOfFile() + try outputFileHandle.close() let output = String(data: outputData, encoding: .utf8) ?? "" return output.contains("Mach-O 64-bit executable") }