Foundation.Process uses CreateProcessW with bInheritHandles = true, which has the side effect of making swift test wait until both the test process AND WinAppDriver.exe exit before returning. If the test process crashes, this is problematic because WinAppDriver.exe will run amok with no one to terminate it, so swift test will wait forever.
Illustrating the issue: run swift test on this and see it never return until closing msinfo32.exe.
import Foundation
import XCTest
class Tests: XCTestCase {
func testFoo() throws {
let process = Process()
process.executableURL = URL(fileURLWithPath: #"C:\windows\system32\msinfo32.exe"#)
try process.run()
}
}
Foundation.Process
usesCreateProcessW
withbInheritHandles = true
, which has the side effect of makingswift test
wait until both the test process ANDWinAppDriver.exe
exit before returning. If the test process crashes, this is problematic becauseWinAppDriver.exe
will run amok with no one to terminate it, soswift test
will wait forever.Illustrating the issue: run
swift test
on this and see it never return until closingmsinfo32.exe
.