PEP 3143: Standard daemon process library

Ben Finney ben+python at benfinney.id.au
Sun Mar 22 00:06:45 CET 2009


Floris Bruynooghe <floris.bruynooghe at gmail.com> writes:

> Had a quick look at the PEP and it looks very nice IMHO.

Thank you. I hope you can try the implementation and report feedback
on that too.

> One of the things that might be interesting is keeping file
> descriptors from the logging module open by default.

Hmm. I see that this would be a good idea. but it raises the question
of how to manage the set of file handles that should not be closed on
becoming a daemon.

So far, the logic of closing the file descriptors is a little complex:

    * Close all open file descriptors. This excludes those listed in
      the `files_preserve` attribute, and those that correspond to the
      `stdin`, `stdout`, or `stderr` attributes.

Extending that by saying “… and also any file descriptors for
``logging.FileHandler`` objects” starts to make the description too
complex. I have a strong instinct that it the description is complex,
the design might be bad.

Can you suggest an alternative API that will ensure that all file
descriptors get closed *except* those that should not be closed?

-- 
 \        “The Bermuda Triangle got tired of warm weather. It moved to |
  `\               Alaska. Now Santa Claus is missing.” —Steven Wright |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list