diff --git a/package.yaml b/package.yaml index 1204b1749..866e12c1d 100644 --- a/package.yaml +++ b/package.yaml @@ -83,7 +83,7 @@ library: - bytestring - Cabal - containers - - dhall >= 1.29.0 + - dhall >= 1.31.1 - directory >= 1.3.4.0 - either - exceptions @@ -104,7 +104,7 @@ library: - prettyprinter - process - retry - - rio + - rio >= 0.1.13.0 - rio-orphans - safe - semver-range diff --git a/src/Spago/Prelude.hs b/src/Spago/Prelude.hs index f96a2cd42..f5d409b4d 100644 --- a/src/Spago/Prelude.hs +++ b/src/Spago/Prelude.hs @@ -228,6 +228,9 @@ pretty = PrettyText.renderStrict -- or die trying findExecutableOrDie :: HasLogFunc env => String -> RIO env Text findExecutableOrDie cmd = do - Directory.findExecutable cmd >>= \case + Directory.findExecutable cmd >>= \case Nothing -> die [ "Executable was not found in path: " <> displayShow cmd ] - Just path -> pure $ Text.pack path + -- Note: we ignore the path and just return the input because the one we get + -- here is absolute, and Windows doesn't seem to be able to deal with that. + -- See: https://github.com/purescript/spago/issues/635 + Just _path -> pure $ Text.pack cmd diff --git a/src/Spago/RunEnv.hs b/src/Spago/RunEnv.hs index 522a0c3df..0c6d2abd2 100644 --- a/src/Spago/RunEnv.hs +++ b/src/Spago/RunEnv.hs @@ -3,6 +3,7 @@ module Spago.RunEnv where import Spago.Prelude import Spago.Env +import qualified Data.Text as Text import qualified System.Environment as Env import qualified Distribution.System as OS import qualified Turtle @@ -120,14 +121,13 @@ getPurs usePsa = do UsePsa -> findExecutable "psa" >>= \case Just _ -> pure "psa" Nothing -> pure "purs" - try (findExecutableOrDie pursCandidate) >>= \case - Right p -> pure p - -- one last try for Windows - Left (err :: SomeException) -> case OS.buildOS of - OS.Windows -> do - logDebug $ displayShow err - findExecutableOrDie (pursCandidate <> ".cmd") - _ -> throwIO err + -- We first try this for Windows + case OS.buildOS of + OS.Windows -> do + findExecutable (pursCandidate <> ".cmd") >>= \case + Just _ -> pure (Text.pack pursCandidate <> ".cmd") + Nothing -> findExecutableOrDie pursCandidate + _ -> findExecutableOrDie pursCandidate getPackageSet :: (HasLogFunc env, HasConfigPath env) => RIO env PackageSet getPackageSet = do