Ticket #3997 enhancement new
Replace getProcess* helpers with a single, better, API.
| Reported by: | spiv | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | core | Keywords: | |
| Cc: | khorn, tom.prince@… | Branch: | |
| Author: | Launchpad Bug: |
Description
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.
