[Twisted-Python] Please help me with process spawning

Hi,
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, Alexey.

On 6/7/07, Alexey Maksimov alexey.maksimov@gmail.com wrote:
Hi,
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, Alexey.
Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
I'm not sure I understand your problem, but here's what I think you should do:
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 pagehttp://twistedmatrix.com/projects/core/documentation/howto/process.htmlin the docs explains the most general way, where you have complete control 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 output: twisted.internet.utils.getProcessOutput().
Cheers, Christian
participants (2)
-
Alexey Maksimov
-
christian simms