def _waitpid(self, wanted_pid):
if wanted_pid:
if wanted_pid not in self.dict:
raise PtraceError("Unknown PID: %r" % wanted_pid, pid=wanted_pid)
debug("Wait process %s" % wanted_pid)
try:
pid, status = waitpid(wanted_pid, 0)
except OSError, err:
if err.errno == ECHILD:
process = self[wanted_pid]
raise process.processTerminated()
else:
raise err
else:
debug("Wait any process")
pid, status = waitpid(-1, 0)
if wanted_pid and pid != wanted_pid:
raise PtraceError("Unwanted PID: %r (instead of %s)"
% (pid, wanted_pid), pid=pid)
return pid, status
评论列表
文章目录