#1842: runInteractiveCommand should install SIGCHLD handler
----------------------------------------+-----------------------------------
    Reporter:  firefly                  |        Owner:          
        Type:  bug                      |       Status:  new     
    Priority:  normal                   |    Milestone:          
   Component:  libraries/base           |      Version:  6.8.1   
    Severity:  normal                   |   Resolution:          
    Keywords:  fork(), wait(), SIGCHLD  |     Testcase:          
Architecture:  Unknown                  |           Os:  Multiple
----------------------------------------+-----------------------------------
Changes (by firefly):

  * testcase:  module Main where
-- Test case for process fork/SIGCHLD bug
--  2007-11-07  Peter Lund <[EMAIL PROTECTED]>
--
-- compile with one of:
--    ghc --make bug
--    ghc -threaded --make bug  # this will crash faster
--
-- run with:
--    ./bug
--
-- expected result:
--    a long list of numbers + "ok"
--
-- actual result:
--    the program abruptly stops with exit code 141 (echo
               $?) which is SIGCHLD
--
-- tested with (with or without the hClose calls):
--    ghc 6.6.1 on Ubuntu Gutsy Gibbon
--    ghc 6.8.1 on Ubuntu Gutsy Gibbon
--    ghc 6.6   on Ubuntu Feisty Fawn
--    ghc 6.4.2 on Gentoo <mumble>
--    (+ ghci versions of above)

import System.IO
import System.Process


runTest         :: String -> IO ()
runTest s       =  do{ print s
                     ; (inp, out, err, ph) <-
               runInteractiveCommand ("true")
                     ; hPutStr inp s
                     ; waitForProcess ph
                     ; hClose inp
                     ; hClose out
                     ; hClose err
                     ; return ()
                     }

main    :: IO ()
main    = do{ mapM_ runTest (map show [1..1000])
            ; putStrLn "OK"
            ; return ()
            } =>
  * keywords:  fork, SIGCHLD => fork(), wait(), SIGCHLD

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1842#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to