diff --git a/src/app/Fake.Core.Process/Process.fs b/src/app/Fake.Core.Process/Process.fs index 558b8245438..bb480b82dd5 100644 --- a/src/app/Fake.Core.Process/Process.fs +++ b/src/app/Fake.Core.Process/Process.fs @@ -619,9 +619,12 @@ module Process = |> fun path -> // See https://unix.stackexchange.com/questions/280528/is-there-a-unix-equivalent-of-the-windows-environment-variable-pathext if Environment.isWindows then - Environment.environVarOrDefault "PATHEXT" ".COM;.EXE;.BAT" - |> String.split ';' - |> Seq.tryPick (fun postFix -> tryFindFile path (file + postFix)) + match tryFindFile path file with + | Some s -> Some s + | None -> + Environment.environVarOrDefault "PATHEXT" ".COM;.EXE;.BAT" + |> String.split ';' + |> Seq.tryPick (fun postFix -> tryFindFile path (file + postFix)) else tryFindFile path file /// Returns the AppSettings for the key - Splitted on ; @@ -893,4 +896,4 @@ module ProcStartInfoExtensions = member x.WithVerb name = { x with Verb = name } #endif /// When UseShellExecute is true, the fully qualified name of the directory that contains the process to be started. When the UseShellExecute property is false, the working directory for the process to be started. The default is an empty string (""). - member x.WithWorkingDirectory dir = { x with WorkingDirectory = dir } \ No newline at end of file + member x.WithWorkingDirectory dir = { x with WorkingDirectory = dir }