Skip to content

Commit

Permalink
Merge pull request #4664 from commercialhaskell/2742-warn-docker-miss…
Browse files Browse the repository at this point in the history
…ing-path

Warn on missing PATH in Docker image (fixes #2742)
  • Loading branch information
snoyberg authored Mar 28, 2019
2 parents d86dc35 + 49a400b commit a73fff7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ Other enhancements:
* `get-stack` script now works on Windows CI machines of Appveyor,
Travis and Azure Pipelines. See
[#4535](https://github.com/commercialhaskell/stack/issues/4535)
* Warn when a Docker image does not include a `PATH` environment
variable. See
[#2472](https://github.com/commercialhaskell/stack/issues/2742)

Bug fixes:

Expand Down
6 changes: 5 additions & 1 deletion src/Stack/Docker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,15 @@ runContainerAndExit = do
-- in place for now, for users who haven't upgraded yet.
(isTerm || (isNothing bamboo && isNothing jenkins))
hostBinDirPath <- parseAbsDir hostBinDir
let mpath = T.pack <$> lookupImageEnv "PATH" imageEnvVars
when (isNothing mpath) $ do
logWarn "The Docker image does not set the PATH env var"
logWarn "This will likely fail, see https://github.com/commercialhaskell/stack/issues/2742"
newPathEnv <- either throwM return $ augmentPath
( toFilePath <$>
[ hostBinDirPath
, sandboxHomeDir </> relDirDotLocal </> relDirBin])
(T.pack <$> lookupImageEnv "PATH" imageEnvVars)
mpath
(cmnd,args,envVars,extraMount) <- getCmdArgs docker imageInfo isRemoteDocker
pwd <- getCurrentDir
liftIO
Expand Down

0 comments on commit a73fff7

Please sign in to comment.