aboutsummaryrefslogtreecommitdiff
path: root/src/CabalHelper/Compiletime/Program/GHC.hs
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2020-01-11 05:08:03 +0100
committerDaniel Gröber <dxld@darkboxed.org>2020-01-11 05:43:16 +0100
commit1c0f2e8c403126acecfd6d6cccf2ad0b20f38929 (patch)
tree94584c7b89118d95747275b489ce71d4b427493e /src/CabalHelper/Compiletime/Program/GHC.hs
parent996c06766d7e1f0f0c4c4cde430e1ea730ffa025 (diff)
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
Diffstat (limited to 'src/CabalHelper/Compiletime/Program/GHC.hs')
-rw-r--r--src/CabalHelper/Compiletime/Program/GHC.hs5
1 files changed, 4 insertions, 1 deletions
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
]