Skip to content

Commit 1cef315

Browse files
committed
Update TestProcess.swift
1 parent bfbc332 commit 1cef315

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Tests/Foundation/Tests/TestProcess.swift

+12-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ class TestProcess : XCTestCase {
1212
func test_exit0() throws {
1313
let process = Process()
1414
let executableURL = xdgTestHelperURL()
15-
process.executableURL = executableURL
15+
if #available(OSX 10.13, *) {
16+
process.executableURL = executableURL
17+
} else {
18+
// Fallback on earlier versions
19+
process.launchPath = executableURL.path
20+
}
1621
XCTAssertEqual(process.launchPath, executableURL.path)
1722
process.arguments = ["--exit", "0"]
1823
try process.run()
@@ -966,7 +971,12 @@ internal func runTask(_ arguments: [String], environment: [String: String]? = ni
966971
let process = Process()
967972

968973
var arguments = arguments
969-
process.executableURL = URL(fileURLWithPath:arguments.removeFirst())
974+
if #available(OSX 10.13, *) {
975+
process.executableURL = URL(fileURLWithPath:arguments.removeFirst())
976+
} else {
977+
// Fallback on earlier versions
978+
process.launchPath = arguments.removeFirst()
979+
}
970980
process.arguments = arguments
971981
// Darwin Foundation doesnt allow .environment to be set to nil although the documentation
972982
// says it is an optional. https://developer.apple.com/documentation/foundation/process/1409412-environment

0 commit comments

Comments
 (0)