Replace getProcess* helpers with a single, better, API.
[email protected] Thu, 03 Sep 2009 04:11:54 -0000
| Newsgroups | gmane.comp.python.twisted.bugs |
|---|---|
| Message-ID | <[email protected]> |
New submission from spiv <[email protected]>: I think the subprocess module has the right idea: give you a single good way to start a function, and declare whether you want to capture/discard/ignore the various stdio streams etc, and then return an object with useful attributes. So I propose that instead of `getProcessValue`, `getProcessOutput`, `getProcessOutputAndValue` (did I miss any?) we have a single method, that takes args like: {{{ foo(stdout=fileLikeObject, ...) }}} and returns a Deferred that yields an object with a `.exitValue` attribute, and perhaps others (for finding out if a signal terminated it, maybe?). Returning an object certainly seems like a much better API than e.g. the tuples from `getProcessOutputAndValue`. Obviously this new function would need a better name than `foo`. Probably any new API here should try to address the problems with the existing APIs described by exarkun in a comment at http://twistedmatrix.com/trac/ticket/280. Quite possibly the proposal in this vague sketch could be improved even further. Please feel free to criticise, suggest improvements, suggest more precise details for the signature, etc. I figured it was better to capture a rough idea than forget it entirely. ---------- Type : enhancement Component: core Keywords : Priority : normal Nosy : ---------- http://twistedmatrix.com/trac/ticket/3997