def add_close(self, fd): """Add the file descriptor fd to the list of descriptors to be closed in the new process.""" if not isinstance(fd, int): raise TypeError("fd must be int type") rc = lib.posix_spawn_file_actions_addclose(self.fa, fd) _check_error(rc)
def walk_func(data, fd): wd = ffi.cast("walk_data *", data) if fd >= wd.start_fd and fd != wd.skip_fd: rc = lib.posix_spawn_file_actions_addclose(wd.fap, fd) _check_error(rc) return 0