def set_inheritable(fd, inheritable):
flags = fcntl.fcntl(fd, fcntl.F_GETFD)
if inheritable:
newflags = flags & ~fcntl.FD_CLOEXEC
else:
newflags = flags | fcntl.FD_CLOEXEC
fcntl.fcntl(fd, fcntl.F_SETFD, newflags)
# ...or shutil.which
评论列表
文章目录