summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2020-07-13 19:22:35 +0200
committerBen Gamari <ben@well-typed.com>2020-11-19 15:36:22 -0500
commit57b5f130a4b0d719b6867a5cea1b1c8a73bbe60f (patch)
tree29d72e6e4c44a37ea0c515e95462cb462b26ed3e
parent3571cc4137bebf067d7c88ec0206104cb5149676 (diff)
downloadhaskell-57b5f130a4b0d719b6867a5cea1b1c8a73bbe60f.tar.gz
loadFramework: Output the errors collected in all loading attempts.
With the recent change away from first finding and then loading a framework, loadFramework had no way of communicating the real reason why loadDLL failed if it was any reason other than the framework missing from the file system. It now collects all loading attempt errors into a list and concatenates them into a string to return to the caller.
-rw-r--r--compiler/ghci/Linker.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs
index 91aa8d4e06..d99e61ff66 100644
--- a/compiler/ghci/Linker.hs
+++ b/compiler/ghci/Linker.hs
@@ -1689,22 +1689,24 @@ loadFramework hsc_env extraPaths rootname
Left _ -> []
Right dir -> [dir </> "Library/Frameworks"]
ps = extraPaths ++ homeFrameworkPath ++ defaultFrameworkPaths
- ; findLoadDLL ps }
+ ; errs <- findLoadDLL ps []
+ ; return $ fmap (intercalate ", ") errs
+ }
where
fwk_file = rootname <.> "framework" </> rootname
-- sorry for the hardcoded paths, I hope they won't change anytime soon:
defaultFrameworkPaths = ["/Library/Frameworks", "/System/Library/Frameworks"]
- findLoadDLL [] =
+ findLoadDLL [] errs =
-- Tried all our known library paths, but dlopen()
-- has no built-in paths for frameworks: give up
- return (Just "not found")
- findLoadDLL (p:ps) =
+ return $ Just errs
+ findLoadDLL (p:ps) errs =
do { dll <- loadDLL hsc_env (p </> fwk_file)
; case dll of
- Nothing -> return Nothing
- Just _ -> findLoadDLL ps
+ Nothing -> return Nothing
+ Just err -> findLoadDLL ps ((p ++ ": " ++ err):errs)
}
{- **********************************************************************