File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,9 @@ public final class UserToolchain: Toolchain {
129
129
return lookupExecutablePath ( filename: getenv ( variable) , searchPaths: searchPaths)
130
130
}
131
131
132
+ /// Environment to use when looking up tools.
133
+ private let processEnvironment : [ String : String ]
134
+
132
135
public func getClangCompiler( ) throws -> AbsolutePath {
133
136
134
137
if let clangCompiler = _clangCompiler {
@@ -142,7 +145,7 @@ public final class UserToolchain: Toolchain {
142
145
clangCompiler = value
143
146
} else {
144
147
// No value in env, so search for `clang`.
145
- let foundPath = try Process . checkNonZeroExit ( arguments: whichClangArgs) . chomp ( )
148
+ let foundPath = try Process . checkNonZeroExit ( arguments: whichClangArgs, environment : processEnvironment ) . chomp ( )
146
149
guard !foundPath. isEmpty else {
147
150
throw InvalidToolchainDiagnostic ( " could not find `clang` " )
148
151
}
@@ -157,8 +160,9 @@ public final class UserToolchain: Toolchain {
157
160
return clangCompiler
158
161
}
159
162
160
- public init ( destination: Destination , environment: [ String : String ] = Process . env) throws {
163
+ public init ( destination: Destination , environment: [ String : String ] = Process . env) throws {
161
164
self . destination = destination
165
+ self . processEnvironment = environment
162
166
163
167
// Get the search paths from PATH.
164
168
let searchPaths = getEnvSearchPaths (
You can’t perform that action at this time.
0 commit comments