From 1c0f2e8c403126acecfd6d6cccf2ad0b20f38929 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sat, 11 Jan 2020 05:08:03 +0100 Subject: Unset GHC_ENVIRONMENT and GHC_PACKAGE_PATH before invocing GHC When we are invoked under Stack (as part of HIE's test suite for example) our choice of Cabal library when invoking GHC gets interferred with by the GHC_ENVIRONMENT variable. Since we're just using boot packages simply unsetting GHC package related envvars seems like a fairly decent fix here. See the issue below for more details. Fixes #78 --- src/CabalHelper/Compiletime/Program/GHC.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/CabalHelper/Compiletime/Program') diff --git a/src/CabalHelper/Compiletime/Program/GHC.hs b/src/CabalHelper/Compiletime/Program/GHC.hs index b24222f..3baf6d9 100644 --- a/src/CabalHelper/Compiletime/Program/GHC.hs +++ b/src/CabalHelper/Compiletime/Program/GHC.hs @@ -134,7 +134,10 @@ cabalVersionExistsInPkgDb cabalVer db@(PackageDbDir db_path) = do invokeGhc :: Env => GhcInvocation -> IO (Either ExitCode FilePath) invokeGhc GhcInvocation {..} = do - rv <- callProcessStderr' (Just "/") [] (ghcProgram ?progs) $ concat + -- We unset some interferring envvars here for stack, see: + -- https://github.com/DanielG/cabal-helper/issues/78#issuecomment-557860898 + let eos = [("GHC_ENVIRONMENT", EnvUnset), ("GHC_PACKAGE_PATH", EnvUnset)] + rv <- callProcessStderr' (Just "/") eos (ghcProgram ?progs) $ concat [ [ "-outputdir", giOutDir , "-o", giOutput ] -- cgit v1.2.3