diff --git a/changelogs/fragments/70683-terminal-ansi-re.yaml b/changelogs/fragments/70683-terminal-ansi-re.yaml new file mode 100644 index 00000000000..b915c7d4bab --- /dev/null +++ b/changelogs/fragments/70683-terminal-ansi-re.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - Terminal plugins - add "\e[m" to the list of ANSI sequences stripped from device output diff --git a/lib/ansible/plugins/terminal/__init__.py b/lib/ansible/plugins/terminal/__init__.py index 23b497cfb3b..bb3ad1812f6 100644 --- a/lib/ansible/plugins/terminal/__init__.py +++ b/lib/ansible/plugins/terminal/__init__.py @@ -48,8 +48,9 @@ class TerminalBase(with_metaclass(ABCMeta, object)): #: compiled bytes regular expressions to remove ANSI codes ansi_re = [ - re.compile(br'(\x1b\[\?1h\x1b=)'), - re.compile(br'\x08.') + re.compile(br'\x1b\[\?1h\x1b='), # CSI ? 1 h ESC = + re.compile(br'\x08.'), # [Backspace] . + re.compile(br"\x1b\[m"), # ANSI reset code ] #: terminal initial prompt