IHaskell.Eval.Evaluate: handle multiline input correctly

This commit is contained in:
Vaibhav Sagar 2018-09-11 11:04:37 -04:00
parent d910a38957
commit 496fbd160a
2 changed files with 5 additions and 3 deletions

View File

@ -692,13 +692,12 @@ evalCommand publish (Directive ShellCmd cmd) state = wrapExecution state $
mExitCode <- getProcessExitCode process
case mExitCode of
Nothing -> do
-- Process still running
next <- readChars pipe "" maxSize
modifyMVar_ outputAccum (return . (++ next))
-- Write to frontend and repeat.
readMVar outputAccum >>= output
loop
Just exitCode -> do
next <- readChars pipe "" maxSize
modifyMVar_ outputAccum (return . (++ next))
out <- readMVar outputAccum
case exitCode of
ExitSuccess -> return $ Display [plain out]

View File

@ -157,6 +157,9 @@ testEval =
"putStrLn \"Héllö, Üñiço∂e!\"" `becomes` ["Héllö, Üñiço∂e!"]
"putStrLn \"Привет!\"" `becomes` ["Привет!"]
it "prints multiline output correctly" $ do
":! printf \"hello\\nworld\"" `becomes` ["hello\nworld"]
it "evaluates directives" $ do
#if MIN_VERSION_ghc(8,2,0)
-- It's `p` instead of `t` for some reason