fgimian / paramiko-expect

A Python expect-like extension for the Paramiko SSH library which also supports tailing logs.
MIT License
204 stars 78 forks source link

Strip ANSI CSI codes from xterm output #79

Closed droscy closed 2 years ago

droscy commented 2 years ago

On my linux box the display from expect() always prints ESC[?2004h or ESC[?2004l before the prompt and that brakes the expect() itself. On the web I found that those codes could be xterm CSI codes (see wiki) so I changed the regex in strip_ansi_codes() to handle them.