我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用os.set_handle_inheritable()。
def set_inheritable(self, inheritable): os.set_handle_inheritable(self.fileno(), inheritable)
def set_handle_inheritable(handle, inheritable): flags = HANDLE_FLAG_INHERIT if inheritable else 0 ok = SetHandleInformation(handle, HANDLE_FLAG_INHERIT, flags) if not ok: raise WinError()
def to_subprocess(self): if MS_WINDOWS: set_handle_inheritable(self._handle, True) arg = self._handle else: set_inheritable(self._fd, True) arg = self._fd return str(arg)