[Twisted-Python] More general process.Process class
markus at bluegap.ch
Wed Jul 4 10:13:14 EDT 2007
I'm currently fiddling with spawnProcess() and such, trying to stream
it's output to somewhere else. In a first attempt, I've tried to cache
the data in the ProcessProtocol's outReceived() call.
Then, I've realized, that twisted already has quite nice abstractions of
Producers and Consumers. I would like to use them, as they seem to fit
And in my case, it would even make much sense to *not* read all the data
from the process, but leave it there, waiting on the file descriptor,
until I'm ready to process the data.
Unfortunately, AFAICT the producers attached to the process - namely the
ProcessReader() instances created by process.Process - are hard wired to
the ProcessProtocol's dataReceived() method. While I would like to use
these producers directly, instead of providing such a ProcessProtocol.
I'm thinking about ripping out the protocol handling from the
process.Process class. Instead let process.Process return a list of
producers and consumers in self.pipes, as requested. Then let another
wrapper class bridge between those and the ProcessProtocol.
More information about the Twisted-Python