@@ -167,11 +167,19 @@ extension Platform {
167167 public func proxy( _ ctx: SwiftlyCoreContext , _ toolchain: ToolchainVersion , _ command: String , _ arguments: [ String ] , _ env: [ String : String ] = [ : ] ) async throws {
168168 let tcPath = self . findToolchainLocation ( ctx, toolchain) . appendingPathComponent ( " usr/bin " )
169169
170+ let commandTcPath = tcPath. appendingPathComponent ( command)
171+ let commandToRun = if FileManager . default. fileExists ( atPath: commandTcPath. path) {
172+ commandTcPath. path
173+ } else {
174+ command
175+ }
176+
170177 var newEnv = try self . proxyEnv ( ctx, env: ProcessInfo . processInfo. environment, toolchain: toolchain)
171178 for (key, value) in env {
172179 newEnv [ key] = value
173180 }
174- try self . runProgram ( [ tcPath. appendingPathComponent ( command) . path] + arguments, env: newEnv)
181+
182+ try self . runProgram ( [ commandToRun] + arguments, env: newEnv)
175183 }
176184
177185 /// Proxy the invocation of the provided command to the chosen toolchain and capture the output.
@@ -181,7 +189,15 @@ extension Platform {
181189 ///
182190 public func proxyOutput( _ ctx: SwiftlyCoreContext , _ toolchain: ToolchainVersion , _ command: String , _ arguments: [ String ] ) async throws -> String ? {
183191 let tcPath = self . findToolchainLocation ( ctx, toolchain) . appendingPathComponent ( " usr/bin " )
184- return try await self . runProgramOutput ( tcPath. appendingPathComponent ( command) . path, arguments, env: self . proxyEnv ( ctx, env: ProcessInfo . processInfo. environment, toolchain: toolchain) )
192+
193+ let commandTcPath = tcPath. appendingPathComponent ( command)
194+ let commandToRun = if FileManager . default. fileExists ( atPath: commandTcPath. path) {
195+ commandTcPath. path
196+ } else {
197+ command
198+ }
199+
200+ return try await self . runProgramOutput ( commandToRun, arguments, env: self . proxyEnv ( ctx, env: ProcessInfo . processInfo. environment, toolchain: toolchain) )
185201 }
186202
187203 /// Run a program.
0 commit comments