File tree 4 files changed +42
-26
lines changed
3926-ghci-with-sublibraries
module-added-multiple-times
4 files changed +42
-26
lines changed Original file line number Diff line number Diff line change @@ -206,7 +206,7 @@ runRepl cmd args actions = do
206
206
catch
207
207
(hGetChar rStderr >>= hPutChar logFileHandle)
208
208
(\ e -> unless (isEOFError e) $ throw e)
209
- runReaderT (nextPrompt >> actions) (ReplConnection rStdin rStdout)
209
+ runReaderT actions (ReplConnection rStdin rStdout)
210
210
waitForProcess ph
211
211
212
212
repl :: HasCallStack => [String ] -> Repl () -> IO ()
Original file line number Diff line number Diff line change @@ -5,17 +5,25 @@ import Data.List
5
5
import StackTest
6
6
7
7
main :: IO ()
8
- main = do
9
- stack [" clean" ] -- to make sure we can load the code even after a clean
10
- copy " src/Lib.v1" " src/Lib.hs"
11
- copy " src-internal/Internal.v1" " src-internal/Internal.hs"
12
- stack [" build" ] -- need a build before ghci at the moment, see #4148
13
- forkIO fileEditingThread
14
- replThread
8
+ main
9
+ | isWindows =
10
+ putStrLn " This test was disabled on Windows on 25 June 2023 (see \
11
+ \https://github.com/commercialhaskell/stack/issues/6170)."
12
+ | otherwise = do
13
+ stack [" clean" ] -- to make sure we can load the code even after a clean
14
+ copy " src/Lib.v1" " src/Lib.hs"
15
+ copy " src-internal/Internal.v1" " src-internal/Internal.hs"
16
+ stack [" build" ] -- need a build before ghci at the moment, see #4148
17
+ forkIO fileEditingThread
18
+ replThread
15
19
16
20
replThread :: IO ()
17
21
replThread = repl [] $ do
22
+ -- The command must be issued before searching the output for the next prompt,
23
+ -- otherwise, on Windows from msys2-20230526, `stack repl` encounters a EOF
24
+ -- and terminates gracefully.
18
25
replCommand " :main"
26
+ nextPrompt
19
27
line <- replGetLine
20
28
let expected = " hello world"
21
29
when (line /= expected) $
Original file line number Diff line number Diff line change @@ -3,13 +3,17 @@ import StackTest
3
3
4
4
main :: IO ()
5
5
main = do
6
- stack [" build" ]
7
- repl [] $ do
8
- replCommand " putStrLn greeting"
9
- line <- replGetLine
10
- let expected = " Hello, world!"
11
- when (line /= expected) $
12
- error $
13
- " Didn't load correctly.\n "
14
- <> " Expected: " <> expected <> " \n "
15
- <> " Actual : " <> line <> " \n "
6
+ stack [" build" ]
7
+ repl [] $ do
8
+ -- The command must be issued before searching the output for the next
9
+ -- prompt, otherwise, on Windows from msys2-20230526, `stack repl`
10
+ -- encounters a EOF and terminates gracefully.
11
+ replCommand " putStrLn greeting"
12
+ nextPrompt
13
+ line <- replGetLine
14
+ let expected = " Hello, world!"
15
+ when (line /= expected) $
16
+ error $
17
+ " Didn't load correctly.\n "
18
+ <> " Expected: " <> expected <> " \n "
19
+ <> " Actual : " <> line <> " \n "
Original file line number Diff line number Diff line change @@ -4,11 +4,15 @@ import StackTest
4
4
5
5
main :: IO ()
6
6
main = repl [] $ do
7
- replCommand " :main"
8
- line <- replGetLine
9
- let expected = " Hello World!"
10
- when (line /= expected) $
11
- error $
12
- " Main module didn't load correctly.\n "
13
- <> " Expected: " <> expected <> " \n "
14
- <> " Actual : " <> line <> " \n "
7
+ -- The command must be issued before searching the output for the next prompt,
8
+ -- otherwise, on Windows from msys2-20230526, `stack repl` encounters a EOF
9
+ -- and terminates gracefully.
10
+ replCommand " :main"
11
+ nextPrompt
12
+ line <- replGetLine
13
+ let expected = " Hello World!"
14
+ when (line /= expected) $
15
+ error $
16
+ " Main module didn't load correctly.\n "
17
+ <> " Expected: " <> expected <> " \n "
18
+ <> " Actual : " <> line <> " \n "
You can’t perform that action at this time.
0 commit comments