[Haskell-cafe] Preventing leaked open file descriptors when catching exceptions

2012-02-21 Thread Ryan Newton
Hi all, I'm trying to run a loop that repeatedly attempts to open a file until it succeeds. The file is a named pipe in nonblocking mode, so the writer can only connect after the reader has connected. (Perhaps there is some way to determine this by stat'ing the pipe, but I don't know it yet.) T

Re: [Haskell-cafe] Preventing leaked open file descriptors when catching exceptions

2012-02-21 Thread Ryan Newton
FYI, lsof confirms that there are indeed many many open connections to the same FIFO: Is there some other way to get at (and clean up) the file descriptor that is left by System.Posix.IO.openFD after it throws an exception? PingPipes 25115 rrnewton 124r FIFO8,2 0t0 25166171 /tmp/

Re: [Haskell-cafe] Preventing leaked open file descriptors when catching exceptions

2012-02-21 Thread Bryan O'Sullivan
On Tue, Feb 21, 2012 at 8:16 AM, Ryan Newton wrote: > FYI, lsof confirms that there are indeed many many open connections to the > same FIFO: > Like all of the lowest-level I/O functions, openFD just gives you back an integer, and the Fd type has no notion that there's an underlying system resou