@@ -646,9 +646,15 @@ cabalBuildDir workDir = do
646
646
-- If cabal can not figure it out, a 'CradleError' is returned.
647
647
cabalGhcDirs :: FilePath -> CradleLoadResultT IO (FilePath , FilePath )
648
648
cabalGhcDirs workDir = do
649
- libdir <- readProcessWithCwd_ workDir " cabal" [" exec" , " -v0" , " --" , " ghc" , " --print-libdir" ] " "
650
- exe <- readProcessWithCwd_ workDir " cabal"
651
- [" exec" , " -v0" , " --" , " ghc" , " -package-env=-" , " -e" , " do e <- System.Environment.getExecutablePath ; System.IO.putStr e" ] " "
649
+ libdir <- readProcessWithCwd_ workDir " cabal" [" exec" , " -v0" , " --" , " ghc" , " --print-libdir" ] " "
650
+ exe <- readProcessWithCwd_ workDir " cabal"
651
+ -- DON'T TOUCH THIS CODE
652
+ -- This works with 'NoImplicitPrelude', with 'RebindableSyntax' and other shenanigans.
653
+ -- @-package-env=-@ doesn't work with ghc prior 8.4.x
654
+ [ " exec" , " -v0" , " --" , " ghc" , " -package-env=-" , " -ignore-dot-ghci" , " -e"
655
+ , " Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)"
656
+ ]
657
+ " "
652
658
pure (trimEnd exe, trimEnd libdir)
653
659
654
660
cabalAction :: FilePath -> Maybe String -> LoggingFunction -> FilePath -> CradleLoadResultT IO ComponentOptions
0 commit comments