1 # NOTE: win32 support is currently experimental, and not recommended
5 from __future__ import absolute_import, division, print_function, with_statement
9 # See: http://msdn.microsoft.com/en-us/library/ms724935(VS.85).aspx
10 SetHandleInformation = ctypes.windll.kernel32.SetHandleInformation
11 SetHandleInformation.argtypes = (ctypes.wintypes.HANDLE, ctypes.wintypes.DWORD, ctypes.wintypes.DWORD)
12 SetHandleInformation.restype = ctypes.wintypes.BOOL
14 HANDLE_FLAG_INHERIT = 0x00000001
17 def set_close_exec(fd):
18 success = SetHandleInformation(fd, HANDLE_FLAG_INHERIT, 0)
20 raise ctypes.GetLastError()