runInteractiveProcess is broken
Simon Marlow
simonmar at microsoft.com
Wed Oct 27 06:00:43 EDT 2004
I can't repeat this, it works here:
*Main> test1
ExitSuccess
*Main> test2
Just ExitSuccess
(after changing /usr/bin/sleep to /bin/sleep).
The only thing I can think of is that you somehow have a SIGCHLD handler
that calls wait(), but I don't see where that can be happening. GHC
doesn't have any other mechanism for calling wait(), so I don't
understand how the zombies are disappearing before waitForProcess is
called.
Maybe run it through strace and send us the output?
Cheers,
Simon
On 26 October 2004 19:00, Peter Simons wrote:
> Neither of these functions returns the return code of the
> external process as promised:
>
> import System.IO hiding ( catch, try )
> import System.Process
> import Control.Concurrent
>
> sleep :: Int -> IO ()
> sleep n = threadDelay (abs(n) * 1000000)
>
> test1 :: IO ()
> test1 = do
> (_,_,_, pid) <- runInteractiveProcess "/usr/bin/sleep" ["1"]
> Nothing Nothing sleep 5
> rc <- waitForProcess pid
> print rc
>
> -- *Main> test1
> -- *** Exception: waitForProcess: does not exist (No child
> processes)
>
> test2 :: IO ()
> test2 = do
> (_,_,_, pid) <- runInteractiveProcess "/usr/bin/sleep" ["1"]
> Nothing Nothing sleep 5
> rc <- getProcessExitCode pid
> print rc
>
> -- *Main> test2
> -- Nothing
>
> I'm using the ghc from CVS-HEAD on Linux/x86.
>
> Peter
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
More information about the Glasgow-haskell-users
mailing list