[Twisted-Python] suggestions needed on a process output event
Itamar Shtull-Trauring
itamar at itamarst.org
Tue Aug 12 23:05:06 MDT 2003
On Wed, 13 Aug 2003 00:55:09 -0400
Yun Mao <maoy at cis.upenn.edu> wrote:
> 1. Can a reactor listen on several ports at the same time?
Yes. Just do reactor.listenTCP multiple times.
> 2. How to add some special event? For example, I have a process
> running: say "tail -f /var/log/messages". I wish, each time, when the
> process outputs a new line, my protocol could receive such an event
> (like dataReceived), and I can get that new line as my data. How to
> implement this?
reactor.spawnProcess, with a twisted.protocols.basic.LineReceiver hooked
up to the process. See http://twistedmatrix.com/documents/howto/process
--
Itamar Shtull-Trauring http://itamarst.org/
Available for Python & Twisted consulting
More information about the Twisted-Python
mailing list