diff --git a/devlib/utils/misc.py b/devlib/utils/misc.py index 8cfd59f..9565f47 100644 --- a/devlib/utils/misc.py +++ b/devlib/utils/misc.py @@ -474,8 +474,8 @@ def which(name): return None -_bash_color_regex = re.compile('\x1b\\[[0-9;]+m') - +# This matches most ANSI escape sequences, not just colors +_bash_color_regex = re.compile(r'\x1b\[[0-9;]*[a-zA-Z]') def strip_bash_colors(text): return _bash_color_regex.sub('', text) diff --git a/devlib/utils/ssh.py b/devlib/utils/ssh.py index aaab2dd..27c52d2 100644 --- a/devlib/utils/ssh.py +++ b/devlib/utils/ssh.py @@ -444,7 +444,7 @@ class Gem5Connection(TelnetConnection): self._check_ready() result = self._gem5_shell("ls {}".format(source)) - files = result.split() + files = strip_bash_colors(result).split() for filename in files: dest_file = os.path.basename(filename)