Opened 12 months ago

Last modified 3 months 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 Revisions:

Description

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 1.2.0.0 and GHC 7.8.2 on OS X

Change History (2)

comment:1 Changed 8 months ago by thoughtpolice

  • Component changed from libraries/process to Core Libraries
  • Owner set to ekmett

Moving over to new owning component 'Core Libraries'.

comment:2 Changed 3 months ago by snoyberg

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