-
Notifications
You must be signed in to change notification settings - Fork 17
Closed
Labels
Description
Originally reported as fpco/fpco#221. Please see there for the actual use case.
The following (also available from: https://gist.github.com/raw/14234504f980bd1f1ccb/4309cf9fc7dca5332137cd88204c5c097dd9a6a2/issue221.hs) is a reproducing test case for this issue. The test runs against the ide-backend code directly, without any fpco code involved. I've also added a test case to isolation-runner: https://github.com/fpco/fpco/commit/13e7b06a98716744e65070c0b427fb71d6e0dee3
{-# LANGUAGE OverloadedStrings #-}
import IdeSession
import ModuleName
import Data.Monoid
import Test.HUnit
main = do
session <- initSession $ SessionConfig "/home/ubuntu/Desktop/tmp" []
let main' = ModuleName ["Main"]
{-
let updates1 = mconcat
[ updateCodeGeneration True
, updateModule main' "main = putStrLn \"Hi!\" >> getLine"
, updateStdoutBufferMode $ RunLineBuffering Nothing
]
updateSession session updates1 $ const $ return ()
ra1 <- runStmt session main' "main"
out1a <- runWait ra1
out1a @?= Left "Hi!\n"
interrupt ra1
out1b <- runWait ra1
out1b @?= Right (RunProgException "AsyncException: user interrupt")
-}
let updates2 = mconcat
[ updateCodeGeneration True
, updateModule main' "main = interact id"
, updateStdoutBufferMode $ RunLineBuffering Nothing
]
updateSession session updates2 $ const $ return ()
ra2 <- runStmt session main' "main"
supplyStdin ra2 "hello\n"
out2a <- runWait ra2
out2a @?= Left "hello\n"
interrupt ra2
out2b <- runWait ra2
out2b @?= Right (RunProgException "AsyncException: user interrupt")
let updates3 = mconcat
[ updateCodeGeneration True
, updateModule main' "main = putStrLn \"Hi!\" >> getLine"
, updateStdoutBufferMode $ RunLineBuffering Nothing
]
updateSession session updates3 $ const $ return ()
ra3 <- runStmt session main' "main"
out3a <- runWait ra3
out3a @?= Left "Hi!\n"
supplyStdin ra3 "Michael\n"
out3b <- runWait ra3
out3b @?= Right (RunOk "it{v air}")This is high priority for us, since it can mean that a user's session becomes completely non-responsive.