Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Ignore the PATH fix if it is not set #1437

Merged
merged 4 commits into from
Nov 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion install/src/Stack.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ module Stack where
import Development.Shake
import Development.Shake.Command
import Development.Shake.FilePath
import Control.Exception
import Control.Monad
import Data.List
import System.Directory ( copyFile )
import System.FilePath ( searchPathSeparator, (</>) )
import System.Environment ( lookupEnv, setEnv, getEnvironment )
import System.IO.Error ( isDoesNotExistError )
import BuildSystem
import Version
import Print
Expand Down Expand Up @@ -102,7 +104,11 @@ stackBuildFailMsg =
-- |Run actions without the stack cached binaries
withoutStackCachedBinaries :: Action a -> Action a
withoutStackCachedBinaries action = do
mbPath <- liftIO (lookupEnv "PATH")

let getEnvErrorHandler e | isDoesNotExistError e = return Nothing
| otherwise = throwIO e

mbPath <- liftIO (lookupEnv "PATH" `catch` getEnvErrorHandler)

case (mbPath, isRunFromStack) of

Expand Down