[Twisted-Python] More general process.Process class
Markus Schiltknecht
markus at bluegap.ch
Wed Jul 4 08:13:14 MDT 2007
Hi,
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
nicely.
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.
Comments?
Regards
Markus
More information about the Twisted-Python
mailing list