[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: Don't want child process inheriting open sockets

Gabriel Genellina

1/23/2008 2:51:00 AM

En Tue, 22 Jan 2008 13:02:35 -0200, Steven Watanabe
<Steven.Watanabe@autodesk.com> escribió:

> I'm using subprocess.Popen() to create a child process. The child
> process is inheriting the parent process' open sockets, but I don't want
> that. I believe that on Unix systems I could use the FD_CLOEXEC flag,
> but I'm running Windows. Any suggestions?

You could use the DuplicateHandle Windows API function with
bInheritHandle=False to create a non inheritable socket handle, then close
the original one. This should be done for every socket you don't want to
be inherited.

--
Gabriel Genellina