File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -157,21 +157,21 @@ public extension HubApi {
157157 @discardableResult
158158 func download( progressHandler: @escaping ( Double ) -> Void ) async throws -> URL {
159159 guard !downloaded else { return destination }
160-
160+
161161 try prepareDestination ( )
162162 let downloader = Downloader ( from: source, to: destination, using: hfToken)
163163 let downloadSubscriber = downloader. downloadState. sink { state in
164164 if case . downloading( let progress) = state {
165165 progressHandler ( progress)
166166 }
167167 }
168- // We need to assign the cancellable to a var so we keep receiving events, so we suppress the "unused var" warning here
169- let _ = downloadSubscriber
170- try downloader . waitUntilDone ( )
168+ _ = try withExtendedLifetime ( downloadSubscriber ) {
169+ try downloader . waitUntilDone ( )
170+ }
171171 return destination
172172 }
173173 }
174-
174+
175175 @discardableResult
176176 func snapshot( from repo: Repo , matching globs: [ String ] = [ ] , progressHandler: @escaping ( Progress ) -> Void = { _ in } ) async throws -> URL {
177177 let filenames = try await getFilenames ( from: repo, matching: globs)
You can’t perform that action at this time.
0 commit comments