Skip to content

Commit 133fbee

Browse files
committed
[CoreCommands] Pipe environment through to the host toolchain
1 parent 04904e2 commit 133fbee

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Sources/CoreCommands/SwiftCommandState.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,10 +868,10 @@ package final class SwiftCommandState {
868868
return Result(catching: {
869869
try UserToolchain(
870870
swiftSDK: SwiftSDK.hostSwiftSDK(
871-
environment: .process(),
871+
environment: environment,
872872
observabilityScope: self.observabilityScope
873873
),
874-
environment: .process(),
874+
environment: environment,
875875
fileSystem: localFileSystem
876876
)
877877
})

Tests/CommandsTests/SwiftCommandStateTests.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,16 @@ final class SwiftCommandStateTests: CommandsTestCase {
362362
"--triple", "x86_64-unknown-linux-gnu",
363363
]
364364
)
365+
366+
var env: EnvironmentVariables = .process()
367+
env.appendPath("SWIFTPM_CUSTOM_BIN_DIR", value: hostBinDir.pathString)
368+
365369
let swiftCommandState = try SwiftCommandState.makeMockState(
366370
options: options,
367371
fileSystem: fs,
368-
environment: [
369-
"SWIFTPM_CUSTOM_BIN_DIR": hostBinDir.pathString
370-
]
372+
environment: env
371373
)
374+
372375
XCTAssertEqual(swiftCommandState.originalWorkingDirectory, fs.currentWorkingDirectory)
373376
XCTAssertEqual(
374377
try swiftCommandState.getTargetToolchain().swiftCompilerPath,

0 commit comments

Comments
 (0)