Skip to content

Commit a2b39e2

Browse files
committed
Fix #6170 Move nextPrompt after replCommand
1 parent 41c4330 commit a2b39e2

File tree

4 files changed

+31
-19
lines changed

4 files changed

+31
-19
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

+4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ main = do
1515

1616
replThread :: IO ()
1717
replThread = repl [] $ do
18+
-- The command must be issued before searching the output for the next prompt,
19+
-- otherwise, on Windows from msys2-20230526, `stack repl` encounters a EOF
20+
-- and terminates gracefully.
1821
replCommand ":main"
22+
nextPrompt
1923
line <- replGetLine
2024
let expected = "hello world"
2125
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)