pexpect.exitstatus not working?
Adriaan Renting
renting at astron.nl
Tue Sep 6 03:44:27 EDT 2005
I'm doing something along these lines:
"""Check if the task is finished and clean up."""
(pid, status) = os.waitpid(self._pid, os.WNOHANG) ## clean up the zombie
assert(pid == self._pid)
if os.WIFEXITED(status) or os.WIFSIGNALED(status):
self._pid = 0
self.exitstatus = status
assert(self.finished())
del self._pid
os.close(self._child_fd)
os.close(self._errorpipe_end)
## Interpret the return value
if (self.exitstatus == 0 or self.exitstatus > 255):
if (self.exitstatus > 255):
self.exitstatus = self.exitstatus >> 8
else: self.exitstatus = 0
More information about the Python-list
mailing list