Another Nix workaround (fixes #1359)

This commit is contained in:
Michael Snoyman 2017-03-15 06:42:00 +02:00
parent c91f92a829
commit 039046e355
No known key found for this signature in database
GPG Key ID: A048E8C057E86876
3 changed files with 30 additions and 5 deletions

View File

@ -1,3 +1,7 @@
## 1.5.2.2
* I guess `--no-nix-pure` implies Nix... sigh [#1359](https://github.com/yesodweb/yesod/issues/1359)
## 1.5.2.1 ## 1.5.2.1
* Use `--no-nix-pure` [#1357](https://github.com/yesodweb/yesod/issues/1357) * Use `--no-nix-pure` [#1357](https://github.com/yesodweb/yesod/issues/1357)

View File

@ -21,6 +21,7 @@ import qualified Data.Conduit.List as CL
import Data.Default.Class (def) import Data.Default.Class (def)
import Data.FileEmbed (embedFile) import Data.FileEmbed (embedFile)
import qualified Data.Map as Map import qualified Data.Map as Map
import Data.Maybe (isJust)
import qualified Data.Set as Set import qualified Data.Set as Set
import Data.Streaming.Network (bindPortTCP, import Data.Streaming.Network (bindPortTCP,
bindRandomPortTCP) bindRandomPortTCP)
@ -362,9 +363,11 @@ devel opts passThroughArgs = do
sayV "First successful build complete, running app" sayV "First successful build complete, running app"
-- We're going to set the PORT and DISPLAY_PORT variables -- We're going to set the PORT and DISPLAY_PORT variables for
-- for the child below -- the child below. Also need to know if the env program
-- exists.
env <- fmap Map.fromList getEnvironment env <- fmap Map.fromList getEnvironment
hasEnv <- fmap isJust $ findExecutable "env"
-- Keep looping forever, print any synchronous exceptions, -- Keep looping forever, print any synchronous exceptions,
-- and eventually die from an async exception from one of -- and eventually die from an async exception from one of
@ -405,9 +408,27 @@ devel opts passThroughArgs = do
, "Main.main" , "Main.main"
] ]
-} -}
let procDef = setStdin closed $ setEnv env' $ proc "stack"
[ "--no-nix-pure" -- https://github.com/yesodweb/yesod/issues/1357 -- Nix support in Stack doesn't pass along env vars by
-- default, so we use the env command. But if the command
-- isn't available, just set the env var. I'm sure this
-- will break _some_ combination of systems, but we'll
-- deal with that later. Previous issues:
--
-- https://github.com/yesodweb/yesod/issues/1357
-- https://github.com/yesodweb/yesod/issues/1359
let procDef
| hasEnv = setStdin closed $ proc "stack"
[ "exec"
, "--"
, "env"
, "PORT=" ++ show newPort
, "DISPLAY_PORT=" ++ show (develPort opts)
, "runghc" , "runghc"
, develHsPath
]
| otherwise = setStdin closed $ setEnv env' $ proc "stack"
[ "runghc"
, "--" , "--"
, develHsPath , develHsPath
] ]

View File

@ -1,5 +1,5 @@
name: yesod-bin name: yesod-bin
version: 1.5.2.1 version: 1.5.2.2
license: MIT license: MIT
license-file: LICENSE license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com> author: Michael Snoyman <michael@snoyman.com>