diff --git a/Packages/Keychain/Sources/Keychain/Keychain.swift b/Packages/Keychain/Sources/Keychain/Keychain.swift index c7cce63..d5cb829 100644 --- a/Packages/Keychain/Sources/Keychain/Keychain.swift +++ b/Packages/Keychain/Sources/Keychain/Keychain.swift @@ -64,7 +64,7 @@ public extension Keychain { guard let data = read(Data.self, usingQuery: query.rawQuery) else { return nil } - return String(decoding: data, as: UTF8.self) + return String(data: data, encoding: .utf8) } func removePassword(forAccount account: String, belongingToService service: String) { diff --git a/Packages/Keychain/Sources/Keychain/RSAPrivateKey.swift b/Packages/Keychain/Sources/Keychain/RSAPrivateKey.swift index 3d8bdde..ed4c1d6 100644 --- a/Packages/Keychain/Sources/Keychain/RSAPrivateKey.swift +++ b/Packages/Keychain/Sources/Keychain/RSAPrivateKey.swift @@ -24,7 +24,9 @@ public final class RSAPrivateKey { } public convenience init?(_ data: Data) { - let string = String(decoding: data, as: UTF8.self) + guard let string = String(data: data, encoding: .utf8) else { + return nil + } self.init(string) } diff --git a/Packages/Shell/Sources/ShellData/ProcessShell.swift b/Packages/Shell/Sources/ShellData/ProcessShell.swift index f749cca..a81c78f 100644 --- a/Packages/Shell/Sources/ShellData/ProcessShell.swift +++ b/Packages/Shell/Sources/ShellData/ProcessShell.swift @@ -18,13 +18,16 @@ public struct ProcessShell: Shell { process.launchPath = executablePath process.standardInput = nil process.environment = environment - process.launch() + try process.run() let data = pipe.fileHandleForReading.readDataToEndOfFile() + // Explicitly close the pipe file handle to prevent running out of file descriptors. + // See https://github.com/swiftlang/swift/issues/57827 + try pipe.fileHandleForReading.close() process.waitUntilExit() guard process.terminationStatus == 0 else { throw ProcessShellError.unexpectedTerminationStatus(process.terminationStatus) } - return String(decoding: data, as: UTF8.self) + return String(data: data, encoding: .utf8) ?? "" } onCancel: { if sendableProcess.process.isRunning { sendableProcess.process.terminate() diff --git a/xcconfigs/General.xcconfig b/xcconfigs/General.xcconfig index 6e0fa2b..0cdbe6d 100644 --- a/xcconfigs/General.xcconfig +++ b/xcconfigs/General.xcconfig @@ -1,6 +1,6 @@ GENERATE_INFOPLIST_FILE = YES CURRENT_PROJECT_VERSION = 1 -MARKETING_VERSION = 0.9.0 +MARKETING_VERSION = 0.10.1 DEVELOPMENT_TEAM = 566MC7D8D4 CODE_SIGN_STYLE = Automatic CODE_SIGN_ENTITLEMENTS = Tartelet/Supporting files/Tartelet.entitlements