@@ -27,7 +27,7 @@ import TestResources
2727
2828@Suite ( . serialized)
2929struct SubprocessWindowsTests {
30- private let cmdExe : Subprocess . Executable = . path ( " C: \\ Windows \\ System32 \\ cmd.exe " )
30+ private let cmdExe : Subprocess . Executable = . name ( " cmd.exe " )
3131}
3232
3333// MARK: - Executable Tests
@@ -87,7 +87,7 @@ extension SubprocessWindowsTests {
8787 Issue . record ( " Expected to throw POSIXError " )
8888 } catch {
8989 guard let subprocessError = error as? SubprocessError ,
90- let underlying = subprocessError. underlyingError
90+ let underlying = subprocessError. underlyingError
9191 else {
9292 Issue . record ( " Expected CocoaError, got \( error) " )
9393 return
@@ -128,7 +128,6 @@ extension SubprocessWindowsTests {
128128 environment: . inherit,
129129 output: . string
130130 )
131- #expect( result. terminationStatus. isSuccess)
132131 // As a sanity check, make sure there's
133132 // `C:\Windows\system32` in PATH
134133 // since we inherited the environment variables
@@ -249,7 +248,6 @@ extension SubprocessWindowsTests {
249248 output: . data( limit: 2048 * 1024 )
250249 )
251250
252- #expect( catResult. terminationStatus. isSuccess)
253251 // Make sure we read all bytes
254252 #expect(
255253 catResult. standardOutput == expected
@@ -304,7 +302,6 @@ extension SubprocessWindowsTests {
304302 input: . sequence( stream) ,
305303 output: . data( limit: 2048 * 1024 )
306304 )
307- #expect( catResult. terminationStatus. isSuccess)
308305 #expect(
309306 catResult. standardOutput == expected
310307 )
@@ -510,7 +507,7 @@ extension SubprocessWindowsTests {
510507 @Test func testPlatformOptionsCreateNewConsole( ) async throws {
511508 let parentConsole = GetConsoleWindow ( )
512509 let sameConsoleResult = try await Subprocess . run (
513- . path ( " C: \\ Windows \\ System32 \\ WindowsPowerShell \\ v1.0 \\ powershell.exe " ) ,
510+ . name ( " powershell.exe " ) ,
514511 arguments: [
515512 " -File " , windowsTester. string,
516513 " -mode " , " get-console-window " ,
@@ -529,7 +526,7 @@ extension SubprocessWindowsTests {
529526 var platformOptions : Subprocess . PlatformOptions = . init( )
530527 platformOptions. consoleBehavior = . createNew
531528 let differentConsoleResult = try await Subprocess . run (
532- . path ( " C: \\ Windows \\ System32 \\ WindowsPowerShell \\ v1.0 \\ powershell.exe " ) ,
529+ . name ( " powershell.exe " ) ,
533530 arguments: [
534531 " -File " , windowsTester. string,
535532 " -mode " , " get-console-window " ,
@@ -700,12 +697,13 @@ extension SubprocessWindowsTests {
700697 0
701698 )
702699 let pid = try Subprocess . runDetached (
703- . path ( " C: \\ Windows \\ System32 \\ WindowsPowerShell \\ v1.0 \\ powershell.exe " ) ,
700+ . name ( " powershell.exe " ) ,
704701 arguments: [
705702 " -Command " , " Write-Host $PID " ,
706703 ] ,
707704 output: writeFd
708705 )
706+ try writeFd. close ( )
709707 // Wait for process to finish
710708 guard
711709 let processHandle = OpenProcess (
0 commit comments