'poll() -> int
Poll the exit code of the process. Will return None, if the
process has not yet finished and the exit code otherwise.'

def poll(self, block=False):

    if ((self.returncode == None) and self.sock and (block or self.sock.exit_status_ready())):
        while (not self.sock.status_event.is_set()):
            self.sock.status_event.wait(0.05)
        self.returncode = self.sock.recv_exit_status()
    return self.returncode
