[Twisted-Python] reactor.spawnProcess() and file descriptors

Carlos Valiente superdupont at gmail.com
Mon Jun 28 07:52:01 EDT 2010


Hi! Is there any way of telling  reactor.spawnProcess() not to close
all open file descriptors? I've tried passing the following as
``childFDs``:

  childFDs = {0: "w", 1: "r", 2: "r"}
  max_fds = resource.getrlimit(resource.RLIMIT_NOFILE)[1] + 1
  for i in xrange(3, max_fds):
    childFDs[i] = i

but of course it doesn't work, because most of those file descriptors
are not open, and then the call to clear the close-on-exec flag fails.

In case there's no way of avoiding the close, I could try writing a
patch for reactor.spawnProcess(): Something like adding an extra
keyword argument to enable or disable the close, for instance. Would
such a patch have any chance of being accepted?

Thanks,

Carlos



More information about the Twisted-Python mailing list