@@ -70,10 +70,8 @@ public struct MacOS: Platform {
7070 if toolchainsDir == self . defaultToolchainsDirectory {
7171 // If the toolchains go into the default user location then we use the installer to install them
7272 await ctx. print ( " Installing package in user home directory... " )
73- try runProgram (
74- " installer " , " -verbose " , " -pkg " , " \( tmpFile) " , " -target " , " CurrentUserHomeDirectory " ,
75- quiet: !verbose
76- )
73+
74+ try await sys. installer ( . verbose, pkg: tmpFile, target: " CurrentUserHomeDirectory " ) . run ( self , quiet: !verbose)
7775 } else {
7876 // Otherwise, we extract the pkg into the requested toolchains directory.
7977 await ctx. print ( " Expanding pkg... " )
@@ -86,7 +84,7 @@ public struct MacOS: Platform {
8684
8785 await ctx. print ( " Checking package signature... " )
8886 do {
89- try runProgram ( " pkgutil " , " --check-signature " , " \( tmpFile) " , quiet: !verbose)
87+ try await sys . pkgutil ( ) . checkSignature ( pkgPath : tmpFile) . run ( self , quiet: !verbose)
9088 } catch {
9189 // If this is not a test that uses mocked toolchains then we must throw this error and abort installation
9290 guard ctx. mockedHomeDir != nil else {
@@ -96,7 +94,7 @@ public struct MacOS: Platform {
9694 // We permit the signature verification to fail during testing
9795 await ctx. print ( " Signature verification failed, which is allowable during testing with mocked toolchains " )
9896 }
99- try runProgram ( " pkgutil " , " -- verbose" , " -- expand" , " \( tmpFile) " , " \( tmpDir) " , quiet: !verbose)
97+ try await sys . pkgutil ( . verbose) . expand ( pkgPath : tmpFile, dirPath : tmpDir) . run ( self , quiet: !verbose)
10098
10199 // There's a slight difference in the location of the special Payload file between official swift packages
102100 // and the ones that are mocked here in the test framework.
@@ -106,7 +104,7 @@ public struct MacOS: Platform {
106104 }
107105
108106 await ctx. print ( " Untarring pkg Payload... " )
109- try runProgram ( " tar " , " -C " , " \( toolchainDir) " , " -xvf " , " \ ( payload) " , quiet: !verbose)
107+ try await sys . tar ( . directory ( toolchainDir) ) . extract ( . verbose , . archive ( payload) ) . run ( self , quiet: !verbose)
110108 }
111109 }
112110
@@ -119,16 +117,19 @@ public struct MacOS: Platform {
119117
120118 if ctx. mockedHomeDir == nil {
121119 await ctx. print ( " Extracting the swiftly package... " )
122- try runProgram ( " installer " , " -pkg " , " \( archive) " , " -target " , " CurrentUserHomeDirectory " )
123- try ? runProgram ( " pkgutil " , " --volume " , " \( userHomeDir) " , " --forget " , " org.swift.swiftly " )
120+ try await sys. installer (
121+ pkg: archive,
122+ target: " CurrentUserHomeDirectory "
123+ )
124+ try ? await sys. pkgutil ( . volume( userHomeDir) ) . forget ( packageId: " org.swift.swiftly " ) . run ( self )
124125 } else {
125126 let installDir = userHomeDir / " .swiftly "
126127 try await fs. mkdir ( . parents, atPath: installDir)
127128
128129 // In the case of a mock for testing purposes we won't use the installer, perferring a manual process because
129130 // the installer will not install to an arbitrary path, only a volume or user home directory.
130131 let tmpDir = fs. mktemp ( )
131- try runProgram ( " pkgutil " , " -- expand" , " \( archive) " , " \( tmpDir) " )
132+ try await sys . pkgutil ( ) . expand ( pkgPath : archive, dirPath : tmpDir) . run ( self )
132133
133134 // There's a slight difference in the location of the special Payload file between official swift packages
134135 // and the ones that are mocked here in the test framework.
@@ -138,7 +139,7 @@ public struct MacOS: Platform {
138139 }
139140
140141 await ctx. print ( " Extracting the swiftly package into \( installDir) ... " )
141- try runProgram ( " tar " , " -C " , " \( installDir) " , " -xvf " , " \ ( payload) " , quiet: false )
142+ try await sys . tar ( . directory ( installDir) ) . extract ( . verbose , . archive ( payload) ) . run ( self , quiet: false )
142143 }
143144
144145 try self . runProgram ( ( userHomeDir / " .swiftly/bin/swiftly " ) . string, " init " )
@@ -161,9 +162,7 @@ public struct MacOS: Platform {
161162
162163 try await fs. remove ( atPath: toolchainDir)
163164
164- try ? runProgram (
165- " pkgutil " , " --volume " , " \( fs. home) " , " --forget " , pkgInfo. CFBundleIdentifier, quiet: !verbose
166- )
165+ try ? await sys. pkgutil ( . volume( fs. home) ) . forget ( packageId: pkgInfo. CFBundleIdentifier) . run ( self , quiet: !verbose)
167166 }
168167
169168 public func getExecutableName( ) -> String {
0 commit comments