def _wait_for_exec_ready(self):
        while not self.response_received.wait(1) and self.query_timeout != 0:
            if self.query_timeout != 0 and self.query_timeout < self.get_time():
                if self.prev:
                    cmd = self.prev.cmd
                else:
                    cmd = "???"
                self.logger.error("CMD timeout: "+ cmd)
                self.query_timeout = 0
                raise TestStepTimeout(self.name + " CMD timeout: " + cmd)
            self.logger.debug("Waiting for response... "
                              "timeout=%d", self.query_timeout - self.get_time())
            self._dut_is_alive()
        if self.response_coming_in == -1:
            if self.query_async_response is not None:
                self.query_async_response.set_response(CliResponse())
                self.query_async_response = None
            self.logger.error("No response received, DUT died")
            raise TestStepError("No response received, DUT "+self.name+" died")
        if self.query_async_response is not None:
            self.query_async_response.set_response(self.response_coming_in)
            self.query_async_response = None
        self.query_timeout = 0
        return self.response_coming_in