Skip to content

Commit f5ea28e

Browse files
authored
Merge pull request #6174 from commercialhaskell/fix6170
Partial fix #6170 Move nextPrompt after replCommand
2 parents 41c4330 + cad3c2d commit f5ea28e

File tree

4 files changed

+42
-26
lines changed

4 files changed

+42
-26
lines changed

test/integration/lib/StackTest.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ runRepl cmd args actions = do
206206
catch
207207
(hGetChar rStderr >>= hPutChar logFileHandle)
208208
(\e -> unless (isEOFError e) $ throw e)
209-
runReaderT (nextPrompt >> actions) (ReplConnection rStdin rStdout)
209+
runReaderT actions (ReplConnection rStdin rStdout)
210210
waitForProcess ph
211211

212212
repl :: HasCallStack => [String] -> Repl () -> IO ()

test/integration/tests/3926-ghci-with-sublibraries/Main.hs

+15-7
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,25 @@ import Data.List
55
import StackTest
66

77
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
1519

1620
replThread :: IO ()
1721
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.
1825
replCommand ":main"
26+
nextPrompt
1927
line <- replGetLine
2028
let expected = "hello world"
2129
when (line /= expected) $

test/integration/tests/4270-files-order/Main.hs

+14-10
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import StackTest
33

44
main :: IO ()
55
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"

test/integration/tests/module-added-multiple-times/Main.hs

+12-8
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ import StackTest
44

55
main :: IO ()
66
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"

0 commit comments

Comments
 (0)