Opened 3 years ago

Last modified 3 years ago

#9135 new bug

readProcessWithExitCode leaks when the program does not exist

Reported by: luite Owned by: snoyberg
Priority: normal Milestone:
Component: Core Libraries Version: 7.8.2
Keywords: Cc: core-libraries-committee@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


import Control.Monad
import System.Process
import qualified Control.Exception as C

try' :: IO a -> IO (Either C.SomeException a)
try' = C.try

main = replicateM_ 1000 $ do
  try'           (readProcessWithExitCode "doesnotexist" [] "")
  print =<< try' (readProcessWithExitCode "/bin/echo" ["it works"] "")

This eventually runs out of file descriptors and fails to start the existing process.

Tested with process and GHC 7.8.2 on OS X

Change History (2)

comment:1 Changed 3 years ago by thoughtpolice

Component: libraries/processCore Libraries
Owner: set to ekmett

Moving over to new owning component 'Core Libraries'.

comment:2 Changed 3 years ago by snoyberg

Cc: core-libraries-committee@… added
Owner: changed from ekmett to snoyberg
Note: See TracTickets for help on using tickets.