Use builtin facility for removing cloexec

This commit is contained in:
Kovid Goyal 2022-06-05 12:33:34 +05:30
parent c004fd1f4d
commit f20f4762a8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python3
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import fcntl
import os
import sys
from collections import defaultdict
@ -144,7 +143,7 @@ def environ_of_process(pid: int) -> Dict[str, str]:
def remove_cloexec(fd: int) -> None:
fcntl.fcntl(fd, fcntl.F_SETFD, fcntl.fcntl(fd, fcntl.F_GETFD) & ~fcntl.FD_CLOEXEC)
os.set_inheritable(fd, True)
def remove_blocking(fd: int) -> None: