@@ -323,7 +323,7 @@ public struct Linux: Platform {
323323 }
324324 }
325325
326- public func install( _ ctx: SwiftlyCoreContext , from tmpFile: URL , version: ToolchainVersion , verbose: Bool ) throws {
326+ public func install( _ ctx: SwiftlyCoreContext , from tmpFile: URL , version: ToolchainVersion , verbose: Bool ) async throws {
327327 guard tmpFile. fileExists ( ) else {
328328 throw SwiftlyError ( message: " \( tmpFile) doesn't exist " )
329329 }
@@ -332,7 +332,7 @@ public struct Linux: Platform {
332332 try FileManager . default. createDirectory ( at: self . swiftlyToolchainsDir ( ctx) , withIntermediateDirectories: false )
333333 }
334334
335- ctx. print ( " Extracting toolchain... " )
335+ await ctx. print ( " Extracting toolchain... " )
336336 let toolchainDir = self . swiftlyToolchainsDir ( ctx) . appendingPathComponent ( version. name)
337337
338338 if toolchainDir. fileExists ( ) {
@@ -347,15 +347,18 @@ public struct Linux: Platform {
347347 let destination = toolchainDir. appendingPathComponent ( String ( relativePath) )
348348
349349 if verbose {
350- ctx. print ( " \( destination. path) " )
350+ // To avoid having to make extractArchive async this is a regular print
351+ // to stdout. Note that it is unlikely that the test mocking will require
352+ // capturing this output.
353+ print ( " \( destination. path) " )
351354 }
352355
353356 // prepend /path/to/swiftlyHomeDir/toolchains/<toolchain> to each file name
354357 return destination
355358 }
356359 }
357360
358- public func extractSwiftlyAndInstall( _ ctx: SwiftlyCoreContext , from archive: URL ) throws {
361+ public func extractSwiftlyAndInstall( _ ctx: SwiftlyCoreContext , from archive: URL ) async throws {
359362 guard archive. fileExists ( ) else {
360363 throw SwiftlyError ( message: " \( archive) doesn't exist " )
361364 }
@@ -366,7 +369,7 @@ public struct Linux: Platform {
366369 }
367370 try FileManager . default. createDirectory ( atPath: tmpDir. path, withIntermediateDirectories: true )
368371
369- ctx. print ( " Extracting new swiftly... " )
372+ await ctx. print ( " Extracting new swiftly... " )
370373 try extractArchive ( atPath: archive) { name in
371374 // Extract to the temporary directory
372375 tmpDir. appendingPathComponent ( String ( name) )
@@ -392,7 +395,7 @@ public struct Linux: Platform {
392395
393396 public func verifySignature( _ ctx: SwiftlyCoreContext , archiveDownloadURL: URL , archive: URL , verbose: Bool ) async throws {
394397 if verbose {
395- ctx. print ( " Downloading toolchain signature... " )
398+ await ctx. print ( " Downloading toolchain signature... " )
396399 }
397400
398401 let sigFile = self . getTempFilePath ( )
@@ -406,7 +409,7 @@ public struct Linux: Platform {
406409 to: sigFile
407410 )
408411
409- ctx. print ( " Verifying toolchain signature... " )
412+ await ctx. print ( " Verifying toolchain signature... " )
410413 do {
411414 if let mockedHomeDir = ctx. mockedHomeDir {
412415 try self . runProgram ( " gpg " , " --verify " , sigFile. path, archive. path, quiet: false , env: [ " GNUPGHOME " : mockedHomeDir. appendingPathComponent ( " .gnupg " ) . path] )
@@ -434,7 +437,7 @@ public struct Linux: Platform {
434437 \( selections)
435438 """ )
436439
437- let choice = ctx. readLine ( prompt: " Pick one of the available selections [0- \( self . linuxPlatforms. count) ] " ) ?? " 0 "
440+ let choice = await ctx. readLine ( prompt: " Pick one of the available selections [0- \( self . linuxPlatforms. count) ] " ) ?? " 0 "
438441
439442 guard let choiceNum = Int ( choice) else {
440443 fatalError ( " Installation canceled " )
0 commit comments