def _child_main(self):
self.host.close()
for fd in map(int, os.listdir('/proc/self/fd')):
if fd != self.child.fileno():
try:
os.close(fd)
except OSError:
pass
resource.setrlimit(resource.RLIMIT_CPU, (1, 1))
prctl.set_seccomp(True)
while True:
sz, = struct.unpack('>L', read_exact(self.child, 4))
doc = marshal.loads(read_exact(self.child, sz))
if doc['cmd'] == 'eval':
resp = self.do_eval(doc)
elif doc['cmd'] == 'exit':
_exit(0)
goobs = marshal.dumps(resp)
write_exact(self.child, struct.pack('>L', len(goobs)))
write_exact(self.child, goobs)
评论列表
文章目录