[Haskell-cafe] createProcess interferes with sockets?

Donn Cave donn at avvanta.com
Sun Apr 21 17:55:15 CEST 2013


Quoth Evan Laforge <qdunkan at gmail.com>,

> sleep = Process.createProcess (Process.proc "sleep" ["5"])

 sleep = Process.createProcess
	((Process.proc "sleep" ["5"]) {Process.close_fds = True})


- Because the client uses buffered I/O (hGetContents in this case, but
hGet-anything would be the same), it doesn't "see" the server response
until a) buffer full, or b) end of file (server closes connection.)

- The server does close the connection, but after the "sleep" process
has forked off with a copy of the connection fd.  If it doesn't close
that fd explicitly, it holds it open until process exit (5 seconds.)

	Donn



More information about the Haskell-Cafe mailing list