Add pre-exec hook to spawnProcess
[email protected] Mon, 07 Dec 2009 23:26:22 -0000
| Newsgroups | gmane.comp.python.twisted.bugs |
|---|---|
| Message-ID | <[email protected]> |
New submission from spiv <[email protected]>: Sometimes it's useful to be able to run some code after fork but before exec. For example I just had a case where it would be handy to be able to set the BZR_LOG environment variable to `'bzr.log.%d' % os.getpid()` as a cheap solution to something. mwhudson says he could have used this feature recently as well. The `subprocess` module provides a `preexec_fn` argument, which provides this. It also provides a way to work around bugs like http://bugs.python.org/issue1652! So I think if we provided this feature it would turn out to be useful. I'm not sure what to provide for platforms without fork. `preexec_fn` is documented as "Unix only", so that's probably a reasonable answer for Twisted's equivalent. It's certainly all I care about :) This ticket is perhaps related to #2415. ---------- Type : enhancement Component: core Keywords : Priority : normal Nosy : ---------- http://twistedmatrix.com/trac/ticket/4159