Skip to content

Commit

Permalink
Fix SFTP not compiling after merging multiple PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
Joannis committed Nov 9, 2024
1 parent ee57891 commit dd6dcf5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Sources/Citadel/SFTP/Client/SFTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,14 @@ extension SSHClient {
_ closure: @escaping @Sendable (SFTPClient) async throws -> ReturnType
) async throws -> ReturnType {
let client = try await self.openSFTP(logger: logger)
defer {
try? client.close()
do {
let result = try await closure(client)
try await client.close()
return result
} catch {
try await client.close()
throw error
}
return try await closure(client)
}

/// Open a SFTP subchannel over the SSH connection using the `sftp` subsystem.
Expand Down

0 comments on commit dd6dcf5

Please sign in to comment.