diff --git a/Sources/TSCBasic/Process.swift b/Sources/TSCBasic/Process.swift index 3da43aa0..ab79d893 100644 --- a/Sources/TSCBasic/Process.swift +++ b/Sources/TSCBasic/Process.swift @@ -12,7 +12,7 @@ import class Foundation.ProcessInfo #if os(Windows) import Foundation -import WinSDK.core.sysinfo +import WinSDK #endif @_implementationOnly import TSCclibc diff --git a/Tests/TSCBasicTests/ProcessTests.swift b/Tests/TSCBasicTests/ProcessTests.swift index 48ffdca4..f0d2f6a0 100644 --- a/Tests/TSCBasicTests/ProcessTests.swift +++ b/Tests/TSCBasicTests/ProcessTests.swift @@ -111,8 +111,17 @@ class ProcessTests: XCTestCase { """) + // Create a non-executable file to test. + let tempNonExecutable = tmpdir.appending(component: "program.bc") + try localFileSystem.writeFileContents(tempNonExecutable, bytes: """ + @echo off + exit + + """) + try withCustomEnv(["PATH": tmpdir.pathString]) { XCTAssertNotNil(Process.findExecutable("program.bat")) + XCTAssertNil(Process.findExecutable("program.bc")) } } #endif