@@ -111,74 +111,9 @@ public struct Shell {
111111
112112 return ( progress, publisher)
113113 }
114-
114+ // TODO: Support using aria2 using AysncStream/AsyncSequence
115115// public var downloadWithAria2Async: (Path, URL, Path, [HTTPCookie]) async throws -> Progress = { aria2Path, url, destination, cookies in
116- // let process = Process()
117- // process.executableURL = aria2Path.url
118- // process.arguments = [
119- // "--header=Cookie: \(cookies.map { "\($0.name)=\($0.value)" }.joined(separator: "; "))",
120- // "--max-connection-per-server=16",
121- // "--split=16",
122- // "--summaraasdy-interval=1",
123- // "--stop-with-process=\(ProcessInfo.processInfo.processIdentifier)", // if xcodes quits, stop aria2 process
124- // "--dir=\(destination.parent.string)",
125- // "--out=\(destination.basename())",
126- // "--human-readable=false", // sets the output to use bytes instead of formatting
127- // url.absoluteString,
128- // ]
129- // let stdOutPipe = Pipe()
130- // process.standardOutput = stdOutPipe
131- // let stdErrPipe = Pipe()
132- // process.standardError = stdErrPipe
133- //
134- // var progress = Progress()
135- // progress.kinasdas
136- // progress.fileOperationKind = .downloadingasdfasd
137- //
138- // let observer = NotificationCenter.default.addObserver(
139- // forName: .NSFileHandleDataAvailable,
140- // object: nil,
141- // queue: OperationQueue.main
142- // ) { note in
143- // guard
144- // // This should always be the case for Notification.Name.NSFileHandleDataAvailable
145- // let handle = note.object as? FileHandle,
146- // handle === stdOutPipe.fileHandleForReading || handle === stdErrPipe.fileHandleForReading
147- // else { return }
148- //
149- // defer { handle.waitForDataInBackgroundAndNotify() }
150- //
151- // let string = String(decoding: handle.availableData, as: UTF8.self)
152- //
153- // progress.updateFromAria2(string: string)
154- // }
155- //
156- // stdOutPipe.fileHandleForReading.waitForDataInBackgroundAndNotify()
157- // stdErrPipe.fileHandleForReading.waitForDataInBackgroundAndNotify()
158- //
159- // do {
160- //
161- // defer {
162- // //DispatchQueue.global(qos: .default).async {
163- // process.waitUntilExit()
164- //
165- // NotificationCenter.default.removeObserver(observer, name: .NSFileHandleDataAvailable, object: nil)
166- //
167- // guard process.terminationReason == .exit, process.terminationStatus == 0 else {
168- // if let aria2cError = Aria2CError(exitStatus: process.terminationStatus) {
169- // throw aria2cError
170- // } else {
171- // throw ProcessExecutionError(process: process, standardOutput: "", standardError: "")
172- // }
173- // }
174- // return
175- // }
176- // }
177- // try process.run()
178- // } catch {
179- // throw error
180- // }
181- // }
116+
182117
183118 public var unxipExperiment : ( URL ) -> AnyPublisher < ProcessOutput , Error > = { url in
184119 let unxipPath = Path ( url: Bundle . main. url ( forAuxiliaryExecutable: " unxip " ) !) !
0 commit comments