'Return the exit status of the child process if it has finished,
or -1 if it hasn\'t finished yet.'

def poll(self, _deadstate=None):

    if (self.sts < 0):
        try:
            (pid, sts) = os.waitpid(self.pid, os.WNOHANG)
            if (pid == self.pid):
                self.sts = sts
        except os.error:
            if (_deadstate is not None):
                self.sts = _deadstate
    return self.sts
