finalizers on handles

Ganesh Sittampalam ganesh at earth.li
Wed Jun 24 00:52:19 EDT 2009


On Tue, 23 Jun 2009, Brandon S. Allbery KF8NH wrote:

> On Jun 23, 2009, at 09:41 , Simon Marlow wrote:
>>> main = do
>>> (ih, oh, _, _) <- runInteractiveProcess "cat" [] Nothing Nothing
>>> comphszp <- hGetContents oh
>>> print (length comphszp)
>>> -- hClose ih -- with this line they both deadlock
>
>
> Note that you can trigger this in any language; it's a classic beginner 
> error with pipes (see, for example, the documentation for open2/open3 in 
> Perl or Python for other examples).  Detecting this in the type system 
> would be an interesting idea, but de facto I think this is a "it hurts 
> when I do this".

Sure - but it hurts more when in some environments you get away with it 
and others you don't.

Ganesh


More information about the Glasgow-haskell-users mailing list