diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2021-01-22 15:53:06 +0100 |
---|---|---|
committer | Sebastian Graf <sebastian.graf@kit.edu> | 2021-01-22 16:00:54 +0100 |
commit | 94e02fdda739cb2dcd0debce65f813335d54c430 (patch) | |
tree | 85763437ef4638068cc8e365a389a55afe82e612 | |
parent | 9cc50a0fce206cfecb973c9b061a2912b2361d3e (diff) | |
download | haskell-wip/T19249.tar.gz |
hadrian: Fix `lookupInPath` on Windows (#19249)wip/T19249
By querying the PATH variable explicitly via `getSearchPath`, we can
work around the special behavior of `findExecutable` on Windows, where
it also searches in System32. Fixes #19249.
-rw-r--r-- | hadrian/src/Hadrian/Oracles/Path.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/hadrian/src/Hadrian/Oracles/Path.hs b/hadrian/src/Hadrian/Oracles/Path.hs index ab771a485f..753ae74440 100644 --- a/hadrian/src/Hadrian/Oracles/Path.hs +++ b/hadrian/src/Hadrian/Oracles/Path.hs @@ -4,7 +4,6 @@ module Hadrian.Oracles.Path ( ) where import Control.Monad -import Data.Maybe import Data.Char import Data.List.Extra import Development.Shake @@ -56,7 +55,10 @@ pathOracle = do return windowsPath void $ addOracleCache $ \(LookupInPath name) -> do - let unpack = fromMaybe . error $ "Cannot find executable " ++ quote name - path <- unifyPath . unpack <$> liftIO (findExecutable name) - putLoud $ "| Executable found: " ++ name ++ " => " ++ path - return path + path <- liftIO getSearchPath + exes <- liftIO (findExecutablesInDirectories path name) + exe <- case exes of + [] -> error $ "Cannot find executable " ++ quote name + (exe:_) -> pure $ unifyPath exe + putLoud $ "| Executable found: " ++ name ++ " => " ++ exe + return exe |