mirror of
https://github.com/IHaskell/IHaskell.git
synced 2025-04-19 12:56:08 +00:00
IHaskell.Eval.Evaluate: handle multiline input correctly
This commit is contained in:
parent
d910a38957
commit
496fbd160a
@ -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]
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user