Skip to content

Commit 4ebe06f

Browse files
authored
Tests: use tar rather than echo for sandbox test on Windows (#5513)
`echo` is a `cmd` shell builtin and not available as a standalone binary as from coretuils on Linux. It should be noted that `echo` is available as a shell builtin on Linux and is not required to be provided as a core binary. `tar` is only available on more recent Windows releases with 10 or newer.
1 parent 810f210 commit 4ebe06f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Tests/BasicsTests/SandboxTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ import XCTest
1818
final class SandboxTest: XCTestCase {
1919
func testSandboxOnAllPlatforms() throws {
2020
try withTemporaryDirectory { path in
21+
#if os(Windows)
22+
let command = Sandbox.apply(command: ["tar.exe", "-h"], strictness: .default, writableDirectories: [])
23+
#else
2124
let command = Sandbox.apply(command: ["echo", "0"], strictness: .default, writableDirectories: [])
25+
#endif
2226
XCTAssertNoThrow(try Process.checkNonZeroExit(arguments: command))
2327
}
2428
}

0 commit comments

Comments
 (0)