Commit d53b4fb5 authored by Christiaan Baaij's avatar Christiaan Baaij

Don't use 'lookupEnv' in 'addLibraryPaths'

parent dd0eaeba
......@@ -87,7 +87,7 @@ runTest pkg_descr lbi flags suite = do
clbi = LBI.getComponentLocalBuildInfo lbi
(LBI.CTestName (PD.testName suite))
paths <- LBI.depLibraryPaths True False lbi clbi
addLibraryPath os paths shellEnv
return (addLibraryPath os paths shellEnv)
else return shellEnv
exit <- rawSystemIOWithEnv verbosity cmd opts Nothing (Just shellEnv')
......
......@@ -98,7 +98,7 @@ runTest pkg_descr lbi flags suite = do
(PD.testName suite))
paths <- LBI.depLibraryPaths
True False lbi clbi
addLibraryPath os paths shellEnv
return (addLibraryPath os paths shellEnv)
else return shellEnv
rawSystemIOWithEnv verbosity cmd opts Nothing (Just shellEnv')
-- these handles are closed automatically
......
......@@ -128,8 +128,6 @@ module Distribution.Simple.Utils (
wrapLine,
) where
import Data.Functor
( (<$>) )
import Control.Monad
( join, when, unless, filterM )
import Control.Concurrent.MVar
......@@ -149,7 +147,7 @@ import System.Directory
, doesDirectoryExist, doesFileExist, removeFile, findExecutable
, getModificationTime )
import System.Environment
( getProgName, lookupEnv )
( getProgName )
import System.Exit
( exitWith, ExitCode(..) )
import System.FilePath
......@@ -703,16 +701,21 @@ isInSearchPath path = fmap (elem path) getSearchPath
addLibraryPath :: OS
-> [FilePath]
-> [(String,String)]
-> IO [(String,String)]
addLibraryPath os paths env = do
let libPaths = intercalate [searchPathSeparator] paths
ldPath = case os of
OSX -> "DYLD_LIBRARY_PATH"
_ -> "LD_LIBRARY_PATH"
ldEnv <- maybe libPaths (++ (searchPathSeparator:libPaths)) <$>
lookupEnv ldPath
return (env ++ [(ldPath,ldEnv)])
-> [(String,String)]
addLibraryPath os paths = addEnv
where
pathsString = intercalate [searchPathSeparator] paths
ldPath = case os of
OSX -> "DYLD_LIBRARY_PATH"
_ -> "LD_LIBRARY_PATH"
addEnv [] = [(ldPath,pathsString)]
addEnv ((key,value):xs)
| key == ldPath =
if null value
then (key,pathsString):xs
else (key,value ++ (searchPathSeparator:pathsString)):xs
| otherwise = (key,value):addEnv xs
----------------
-- File globbing
......
......@@ -72,7 +72,7 @@ run verbosity lbi exe exeArgs = do
clbi = getComponentLocalBuildInfo lbi
(CExeName (exeName exe))
paths <- depLibraryPaths True False lbi clbi
addLibraryPath os paths env
return (addLibraryPath os paths env)
else return env
notice verbosity $ "Running " ++ exeName exe ++ "..."
rawSystemExitWithEnv verbosity path exeArgs env'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment