Skip to content

Commit

Permalink
fix: another ansi fixup for some linux boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
carlmontanari committed Apr 27, 2024
1 parent 7785e7d commit 9842cd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scrapli/channel/base_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
rb"("
rb"([78ME])" # control cursor position
rb"|"
rb"([\x07])" # BEL (Terminal bell)
rb"((\]\d).*[\x07])" # BEL (Terminal bell)
rb"|"
rb"(\[[{}();#=?0-9]*[A-Zhglnmsu~])" # control codes starts with `[` e.x. ESC [2;37;41m
rb")",
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/channel/test_base_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ def test_process_output(base_channel):
b"\x1b7c\x1b8\x1b[1C\x1b7o\x1b8\x1b[1C\x1b7n\x1b8\x1b[1C\x1b7f\x1b8\x1b[1C\x1b7i\x1b8\x1b[1C\x1b7g\x1b8\x1b[1C\x1b7u\x1b8\x1b[1C\x1b7r\x1b8\x1b[1C\x1b7e\x1b8\x1b[1C",
b"configure",
),
# https://github.com/carlmontanari/scrapli/discussions/325#discussioncomment-9234132
(
b"\x1b[?2004h\x1b]0;user@line5-cpe-0: ~\x07user@line5-cpe-0:~$",
b"user@line5-cpe-0:~$",
),
),
)
def test_strip_ansi(base_channel, buf: bytes, expected: bytes):
Expand Down

0 comments on commit 9842cd0

Please sign in to comment.