Skip to content

Commit 2e519ed

Browse files
committed
'stack setup': look for ldconfig in 'sbin's
even if those are not in the PATH.
1 parent 937cdd3 commit 2e519ed

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Stack/Setup.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,12 @@ getGhcBuild menv = do
490490
platform <- asks getPlatform
491491
case platform of
492492
Platform _ Linux -> do
493-
eldconfigOut <- tryProcessStdout Nothing menv "ldconfig" ["-p"]
493+
-- Some systems don't have ldconfig in the PATH, so make sure to look in /sbin and /usr/sbin as well
494+
sbinEnv <- modifyEnvOverride menv $
495+
Map.insert "PATH" $
496+
"/sbin:/usr/sbin" <>
497+
(maybe "" (":" <>) $ Map.lookup "PATH" (eoTextMap menv))
498+
eldconfigOut <- tryProcessStdout Nothing sbinEnv "ldconfig" ["-p"]
494499
let firstWords = case eldconfigOut of
495500
Right ldconfigOut -> mapMaybe (headMay . T.words) $
496501
T.lines $ T.decodeUtf8With T.lenientDecode ldconfigOut

0 commit comments

Comments
 (0)