Shouldn't System.Process.runInteractiveCommand close inherited descriptors above 2?

Bryan O'Sullivan bos at serpentine.com
Mon Jun 4 14:03:30 EDT 2007


Tomasz Zielonka wrote:

> So the question is: shouldn't runInteractiveCommand /
> runInteractiveProcess close descriptors greater then 2 in the child
> process?

No.  What your colleague experienced is normal Unix behaviour with about 
30 years of history under its belt.  Having Haskell do something 
different would be the surprise here.

You can mark file descriptors that you don't want shared with fcntl's 
F_SETFD command, and FD_CLOEXEC:

noExec :: Handle -> IO ()
noExec h = do
   fd <- handleToFd h
   setFdOption fd CloseOnExec True

	<b


More information about the Libraries mailing list