Skip to content

Commit

Permalink
testsuite: Don't attempt to read from inherited fd in processT251
Browse files Browse the repository at this point in the history
It turns out that this test is subtly broken. In particular, the
test will fail if any file is opened in the subprocess before the child
is run since the closed fd 0 may be reused for the new file.
This tends to happen in the threaded RTS due to the event manager's
control pipe (see GHC #22395). Unfortunately, it's not really clear how
else haskell#251 can reliably be tested.
  • Loading branch information
bgamari authored and Mistuke committed Mar 11, 2023
1 parent beec99d commit a53e1eb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/processT251.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ child = do
child2 :: IO ()
child2 = do
putStrLn "child2 start"
Left (IOError {ioe_type=InvalidArgument}) <-
try $ getContents >>= print
-- Unfortunate, there isn't a reliable way to test that stdin has been closed.
-- Afterall, if any file is opened in the child, it may reuse the
-- supposedly-closed fd 0. In particular this tends to happen in the
-- threaded RTS, since the event manager's control pipe is opened during
-- RTS initialzation.
putStrLn "child2 done"

0 comments on commit a53e1eb

Please sign in to comment.