[Twisted-Python] Please help me with process spawning
christian.simms at gmail.com
Thu Jun 7 09:53:13 EDT 2007
On 6/7/07, Alexey Maksimov <alexey.maksimov at gmail.com> wrote:
> Please help me with the following:
> I want to write a simple app that should remotely control
> long running shell process. I have a C++ program that does some network
> capturing I need. I want to create a simple web interface that can
> start and stop this program via shell on linux.
> I already wrote a web part of this but failed to spawn my process.
> I think my problem is that I want to use myserver.tac and don't want
> directly call reactor.run() as shown in documentation.
> How can I spawn my long-running process without using reactor.run()?
> Thanks in advance,
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
I'm not sure I understand your problem, but here's what I think you should
Write a twisted application (maybe this is your myserver.tac?) which is a
simple web server. An easy way to write a twisted web app is with
nevow. Since this is a twisted application, assuming your myserver.tac file
defines an object named "application", just run it with:
twistd -noy myserver.tac
The twistd program will automatically call reactor.run() for you, you
normally do not need to call it explicitly.
Now, to launch another process from twisted there are several API's you can
use. This page<http://twistedmatrix.com/projects/core/documentation/howto/process.html>in
the docs explains the most general way, where you have complete
over the inputs and outputs to the spawned program. There's also a
simplified API for launching programs, but it just grabs your process's
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python