mirror of
https://github.com/IHaskell/IHaskell.git
synced 2025-04-14 10:26:07 +00:00
Add output about stack integration when --debug is used
This commit is contained in:
parent
979e462486
commit
861966733a
17
main/Main.hs
17
main/Main.hs
@ -145,14 +145,19 @@ runKernel kOpts profileSrc = do
|
|||||||
Left _ -> False
|
Left _ -> False
|
||||||
Right (_, stackStdout, stackStderr) -> "The Haskell Tool Stack" `isInfixOf` (stackStdout ++ stackStderr)
|
Right (_, stackStdout, stackStderr) -> "The Haskell Tool Stack" `isInfixOf` (stackStdout ++ stackStderr)
|
||||||
|
|
||||||
|
when debug $ putStrLn ("Using stack: " <> show stack)
|
||||||
|
|
||||||
-- If we're in a stack directory, use `stack` to set the environment
|
-- If we're in a stack directory, use `stack` to set the environment
|
||||||
-- We can't do this with base <= 4.6 because setEnv doesn't exist.
|
-- We can't do this with base <= 4.6 because setEnv doesn't exist.
|
||||||
when stack $
|
when stack $ do
|
||||||
readProcess "stack" (["exec", "env"] <> stackFlags) "" >>= parseAndSetEnv
|
when debug $ putStrLn "Using environment from stack:"
|
||||||
|
readProcess "stack" (["exec", "env"] <> stackFlags) "" >>= parseAndSetEnv debug
|
||||||
|
|
||||||
case kernelSpecEnvFile kOpts of
|
case kernelSpecEnvFile kOpts of
|
||||||
Nothing -> return ()
|
Nothing -> return ()
|
||||||
Just envFile -> readFile envFile >>= parseAndSetEnv
|
Just envFile -> do
|
||||||
|
when debug $ putStrLn "Using environment from env file: "
|
||||||
|
readFile envFile >>= parseAndSetEnv debug
|
||||||
|
|
||||||
-- Serve on all sockets and ports defined in the profile.
|
-- Serve on all sockets and ports defined in the profile.
|
||||||
interface <- serveProfile profile debug
|
interface <- serveProfile profile debug
|
||||||
@ -229,11 +234,13 @@ runKernel kOpts profileSrc = do
|
|||||||
|
|
||||||
isCommMessage req = mhMsgType (header req) `elem` [CommDataMessage, CommCloseMessage]
|
isCommMessage req = mhMsgType (header req) `elem` [CommDataMessage, CommCloseMessage]
|
||||||
|
|
||||||
parseAndSetEnv envLines =
|
parseAndSetEnv debug envLines =
|
||||||
forM_ (lines envLines) $ \line -> do
|
forM_ (lines envLines) $ \line -> do
|
||||||
case break (== '=') line of
|
case break (== '=') line of
|
||||||
(_, []) -> return ()
|
(_, []) -> return ()
|
||||||
(key, _:val) -> setEnv key val
|
(key, _:val) -> do
|
||||||
|
when debug $ putStrLn ("\t" <> line)
|
||||||
|
setEnv key val
|
||||||
|
|
||||||
-- Initial kernel state.
|
-- Initial kernel state.
|
||||||
initialKernelState :: KernelSpecOptions -> IO (MVar KernelState)
|
initialKernelState :: KernelSpecOptions -> IO (MVar KernelState)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user