diff --git a/cabal-install-solver/src/Distribution/Solver/Types/PkgConfigDb.hs b/cabal-install-solver/src/Distribution/Solver/Types/PkgConfigDb.hs index 00bc38c28c3..2307b525e4b 100644 --- a/cabal-install-solver/src/Distribution/Solver/Types/PkgConfigDb.hs +++ b/cabal-install-solver/src/Distribution/Solver/Types/PkgConfigDb.hs @@ -67,11 +67,12 @@ readPkgConfigDb verbosity progdb = handle ioErrorHandler $ do -- The output of @pkg-config --list-all@ also includes a description -- for each package, which we do not need. let pkgNames = map (takeWhile (not . isSpace)) pkgList - (pkgVersions, _errs, exitCode) <- + (pkgVersions_, _errs, exitCode) <- getProgramInvocationOutputAndErrors verbosity (programInvocation pkgConfig ("--modversion" : pkgNames)) - if exitCode == ExitSuccess && length pkgNames == length pkgList - then (return . pkgConfigDbFromList . zip pkgNames) (lines pkgVersions) + let pkgVersions = lines pkgVersions_ + if exitCode == ExitSuccess && length pkgVersions == length pkgList + then (return . pkgConfigDbFromList . zip pkgNames) pkgVersions else -- if there's a single broken pc file the above fails, so we fall back -- into calling it individually