do anonymous pipes normally work on NT?

Georg Mischler schorsch at schorsch.com
Sun Jun 20 21:54:12 CEST 1999


Bill Tutt wrote:
> After digging through this stuff, I went back and looked at the code I
had
> written for win32popen.cpp. I realized that I had forgotten why I had
> written the DuplicateHandle() code, so I went back commented it out
from the
> KB article that I had originally used, and then modified runproc.py
to do
> the same thing.
>
> cat.py is now much happier with life with the new and improved
runproc.py.
[more stuff]

Uh oh, Bill...

If you should ever happen to visit the Munich Oktoberfest,
please remind me that I owe you a few beer!

Actually, I stayed with the inheriting version for the moment,
as it will work with existing versions of the win32 extensions.
And I'm not sure if I got the changes in the sources (or the
compilation) right. At least I didn't see any changes after
replacing my win32process.pyd.

The most important thing is of course that my code works now.
I'll have another look at the esthetically more pleasing
changes later, when the dust has settled a little in my brain...


> Notice I also changed the DETACHED_PROCESS to a zero. This is to not
do
> those wierd things that DETACHED_PROCESS seems to do. Since stdin,
etc.. are
> pipes, it doesn't matter if the process technically has access to
> runproc.py's NT console. (if any)

Another thing I noted here, is that with pythonw.exe (instead
python.exe), the second generation of processes gets those
problems again, no matter what you do (my application starts a
"process wrapper" in python, which will call other programs to
do the real work in the background).


> The other alternative from 0 would be to pass in CREATE_NEW_CONSOLE,
> and tweak win32process_win32module.cpp to add:
> 	{"wShowWindow",	     T_INT,  OFF(m_startupinfo.wShowWindow)},
> //@prop integer|wShowWindow|
>
> onto the end of PySTARTUPINFO::memberlist, and then do the following:
>         StartupInfo = win32process.STARTUPINFO()
>         StartupInfo.hStdInput  = hStdin_r
>         StartupInfo.hStdOutput = hStdout_w
>         StartupInfo.hStdError  = hStderr_w
>         StartupInfo.dwFlags = win32process.STARTF_USESTDHANDLES |
> 		win32process.STARTF_USESHOWWINDOW
> 	  StartupInfo.wShowWindow = win32con.SW_HIDE
>
> Mark: please add that line when you get a chance. :)

Yes, I noticed this attribute missing as well, but wasn't sure
what to insert where... Interestingly, STARTF_USESHOWWINDOW
keeps the console window from opening even without it. The
structure member seems to get initialized to zero somehow.


> '''runproc.py
>
[and more of my code expertively enhanced...]


Thanks a lot for all the tips and bug hunting!

-schorsch

--
Georg Mischler  --  simulation developper  --  schorsch at schorsch.com
+schorsch.com+  --  lighting design tools  --  http://www.schorsch.com/


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




More information about the Python-list mailing list