Skip to content

Commit a69879f

Browse files
authored
Merge pull request #2875 from stevapple/multiline-env
Fix test fail triggered by multiline environment variables
2 parents 807e415 + 2094933 commit a69879f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Tests/Foundation/Tests/TestProcess.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,12 @@ class TestProcess : XCTestCase {
215215
do {
216216
let (output, _) = try runTask([xdgTestHelperURL().path, "--env"], environment: nil)
217217
let env = try parseEnv(output)
218+
#if os(Windows)
219+
// On Windows, Path is always passed to the sub process
220+
XCTAssertGreaterThan(env.count, 1)
221+
#else
218222
XCTAssertGreaterThan(env.count, 0)
223+
#endif
219224
} catch {
220225
XCTFail("Test failed: \(error)")
221226
}

Tests/Tools/XDGTestHelper/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ case "--echo-PWD":
232232
print(ProcessInfo.processInfo.environment["PWD"] ?? "")
233233

234234
case "--env":
235-
print(ProcessInfo.processInfo.environment.filter { $0.key != "__CF_USER_TEXT_ENCODING" }.map { "\($0.key)=\($0.value)" }.joined(separator: "\n"))
235+
print(ProcessInfo.processInfo.environment.filter { $0.key != "__CF_USER_TEXT_ENCODING" }.map { "\($0.key)=\($0.value.filter { !$0.isNewline })" }.joined(separator: "\n"))
236236

237237
case "--cat":
238238
cat(arguments)

0 commit comments

Comments
 (0)