Skip to content

Commit

Permalink
Merging pull request 140
Browse files Browse the repository at this point in the history
Signed-off-by: Lukáš Doktor <[email protected]>

* github.com:autotest/aexpect:
  Removing the escape sequence from the console output!
  • Loading branch information
ldoktor committed Nov 29, 2024
2 parents 9febbe9 + 6db1fdd commit 72d2e67
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aexpect/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,11 +1311,13 @@ def cmd_status_output(self, cmd, timeout=60, internal_timeout=None,
# Send the 'echo $?' (or equivalent) command to get the exit status
status = self.cmd_output(self.status_test_command, 30,
internal_timeout, print_func, safe)
# Removing the escape sequence from the status output
clean_status = astring.strip_console_codes(status)
except ShellError as error:
raise ShellStatusError(cmd, out) from error

# Get the first line consisting of digits only
digit_lines = [_ for _ in status.splitlines()
digit_lines = [_ for _ in clean_status.splitlines()
if self.__RE_STATUS.match(_.strip())]
if digit_lines:
return int(digit_lines[0].strip()), out
Expand Down

0 comments on commit 72d2e67

Please sign in to comment.