310 ) |
310 ) |
311 |
311 |
312 # read until prompt |
312 # read until prompt |
313 response = self.__serial.readUntil(b"\x04>", timeout=timeout) |
313 response = self.__serial.readUntil(b"\x04>", timeout=timeout) |
314 if self.__serial.hasTimedOut(): |
314 if self.__serial.hasTimedOut(): |
315 self.__blockReadyRead = False |
315 out, err = b"", b"Timeout while processing commands." |
316 return b"", b"Timeout while processing commands." |
316 break |
317 if b"\x04" in response[:-2]: |
317 if b"\x04" in response[:-2]: |
318 # split stdout, stderr |
318 # split stdout, stderr |
319 out, err = response[:-2].split(b"\x04") |
319 out, err = response[:-2].split(b"\x04") |
320 result += out |
320 result += out |
321 else: |
321 else: |
390 self.__serial.readUntil(b">>> ", timeout=timeout) |
390 self.__serial.readUntil(b">>> ", timeout=timeout) |
391 .replace(b">>> ", b"") |
391 .replace(b">>> ", b"") |
392 .strip() |
392 .strip() |
393 ) |
393 ) |
394 if self.__serial.hasTimedOut(): |
394 if self.__serial.hasTimedOut(): |
395 self.__blockReadyRead = False |
395 out, err = b"", b"Timeout while processing commands." |
396 return b"", b"Timeout while processing commands." |
|
397 |
|
398 # get rid of any OSD string and send it |
|
399 if result.startswith(b"\x1b]0;"): |
|
400 osd, result = result.split(b"\x1b\\", 1) |
|
401 self.osdInfo.emit(osd[4:].decode("utf-8")) |
|
402 |
|
403 if self.TracebackMarker in result: |
|
404 errorIndex = result.find(self.TracebackMarker) |
|
405 out, err = result[:errorIndex], result[errorIndex:] |
|
406 else: |
396 else: |
407 out = result |
397 # get rid of any OSD string and send it |
408 err = b"" |
398 if result.startswith(b"\x1b]0;"): |
|
399 osd, result = result.split(b"\x1b\\", 1) |
|
400 self.osdInfo.emit(osd[4:].decode("utf-8")) |
|
401 |
|
402 if self.TracebackMarker in result: |
|
403 errorIndex = result.find(self.TracebackMarker) |
|
404 out, err = result[:errorIndex], result[errorIndex:] |
|
405 else: |
|
406 out = result |
|
407 err = b"" |
409 |
408 |
410 self.__blockReadyRead = False |
409 self.__blockReadyRead = False |
411 return out, err |
410 return out, err |
412 |
411 |
413 def executeAsync(self, commandsList, submitMode): |
412 def executeAsync(self, commandsList, submitMode): |