[ ghc-Bugs-1187302 ] runProcess doesn't close handles?

SourceForge.net noreply at sourceforge.net
Thu Apr 21 07:24:14 EDT 2005


Bugs item #1187302, was opened at 2005-04-21 11:24
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1187302&group_id=8032

Category: libraries/base
Group: 6.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Roman Leshchinskiy (romanle)
Assigned to: Nobody/Anonymous (nobody)
Summary: runProcess doesn't close handles?

Initial Comment:
The documentation for runProcess says: "Any Handles
passed to runProcess are placed immediately in the
closed state, so may no longer be referenced by the
Haskell process." But

test =
  do
    h <- openFile "output" WriteMode
    ph <- runProcess "/bin/ls" [] Nothing Nothing
              Nothing (Just h) Nothing
    waitForProcess ph

main = test >> test >> return ()

aborts with "output: openFile: resource busy (file is
locked)" on the second call to test whereas 

test =
  do
    h <- openFile "output" WriteMode
    ph <- runProcess "/bin/ls" [] Nothing Nothing
              Nothing (Just h) Nothing
    hClose h
    waitForProcess ph

main = test >> test >> return ()

works fine.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1187302&group_id=8032



More information about the Glasgow-haskell-bugs mailing list