From 873dd77a6fa4f663443ec4bc20ec9b7f635f2855 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Thu, 7 Jul 2022 14:10:18 +0200 Subject: [PATCH] Fix build on windows --- ghcup.cabal | 4 +++- lib/GHCup/Prelude/Process/Windows.hs | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ghcup.cabal b/ghcup.cabal index c2094ea..6c6583f 100644 --- a/ghcup.cabal +++ b/ghcup.cabal @@ -164,8 +164,10 @@ library cpp-options: -DIS_WINDOWS other-modules: GHCup.Prelude.File.Windows - GHCup.Prelude.Process.Windows GHCup.Prelude.Windows + -- GHCup.OptParse.Run uses this + exposed-modules: + GHCup.Prelude.Process.Windows build-depends: , bzlib diff --git a/lib/GHCup/Prelude/Process/Windows.hs b/lib/GHCup/Prelude/Process/Windows.hs index ddfbf6a..89ac9a2 100644 --- a/lib/GHCup/Prelude/Process/Windows.hs +++ b/lib/GHCup/Prelude/Process/Windows.hs @@ -211,8 +211,8 @@ exec exe args chdir env = do let paths = ["PATH", "Path"] curPaths = (\x -> maybe [] splitSearchPath (Map.lookup x cEnv)) =<< paths newPath = intercalate [searchPathSeparator] curPaths - setEnv "PATH" "" - setEnv "Path" newPath + liftIO $ setEnv "PATH" "" + liftIO $ setEnv "Path" newPath cp <- createProcessWithMingwPath ((proc exe args) { cwd = chdir, env = env }) exit_code <- liftIO $ withCreateProcess cp $ \_ _ _ p -> waitForProcess p pure $ toProcessError exe args exit_code @@ -230,8 +230,8 @@ execNoMinGW exe args chdir env = do let paths = ["PATH", "Path"] curPaths = (\x -> maybe [] splitSearchPath (Map.lookup x cEnv)) =<< paths newPath = intercalate [searchPathSeparator] curPaths - setEnv "PATH" "" - setEnv "Path" newPath + liftIO $ setEnv "PATH" "" + liftIO $ setEnv "Path" newPath let cp = (proc exe args) { cwd = chdir, env = env } exit_code <- liftIO $ withCreateProcess cp $ \_ _ _ p -> waitForProcess p pure $ toProcessError exe args exit_code