[Twisted-Python] Suppressing terminal window from reactor.spawnProcess?
teratorn at twistedmatrix.com
Fri Feb 2 05:38:44 EST 2007
On Fri, 02 Feb 2007 02:00:49 -0600, Steve Freitas <sflist at ihonk.com> wrote:
> I'm doing a Twisted app on Windows. As part of its work it uses
> spawnProcess to temporarily spawn a process to communicate with. When I
> run the app from the command line in the usual fashion, spawnProcess()
> goes on and does its thing quietly and nicely. I then turned the Twisted
> app into a Windows Service, and now when it spawns the process, it opens
> a terminal window. Any idea how to suppress that? I tried the usePTY
> argument but of course that ain't supported on Windows.
Unfortunately Twisted doesn't have any way to alter this behavior.
Processes on Windows will inherit the parent's console by default. So when
you run from the command-line it doesn't need to create a new one.
But when run as a service I suspect that the parent process (Twisted) is
created DETACHED, so it doesn't have a console. But when you spawn a new
child it just uses the defaults which then gives you a console.
For what it's worth the win32 API flag of interest is DETACHED_PROCESS
documented here: http://msdn2.microsoft.com/en-us/library/ms684863.aspx
spawnProcess is currently slated for a redesign as per
I will make sure this concern is address in some form or fashion, but in
the mean time you will have to do some work yourself if you really need
this feature. Let use know if you get stuck :)
More information about the Twisted-Python