[Twisted-Python] spawnProcess under Win32

Igor Kravtchenko igor at mekensleep.com
Mon Aug 14 09:15:55 EDT 2006


Hi!

I had recently to use the Process protocol of Twisted (win32eventreactor)
to launch some applications and grab their output.

It works well, the only problem I have is Twisted always opens a DOS 
console.
Since I receive the output and treat them myself, the DOS console stays 
empty.
But in fact, I would never want this console to appear on screen.

I've looked at the way Twisted creates a process under Win32 and I've 
noticed
that it uses the CreateProcess() function.  The problem is it doesn't 
mention any
creation flags (i.e.: it just passes 0) whereas here, we would need to pass
DETACHED_PROCESS to avoid a new console to be created.

What I've done is merely to add an optional win32flags argument to the 
spawnProcess()
method in win32eventreactor.py as follow:

http://cvs.gna.org/cvsweb/envwin32/python/Lib/site-packages/twisted/internet/win32eventreactor.py?rev=1.2;cvsroot=underware

I would be interested to know what do you think about this?
Does it seem to you a good idea?

Sincerely,

Igor.





More information about the Twisted-Python mailing list