diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2022-05-12 15:12:05 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-05-19 15:24:15 +0200 |
commit | c638129a9e803388a37d95c4c411047571556109 (patch) | |
tree | a3a35a8a27c38cd050f1686d05c7f9f2b0f93fe8 /test/distro/debian | |
parent | ae83999b75165669ba468defa4cddced3ef2b058 (diff) | |
download | passt-c638129a9e803388a37d95c4c411047571556109.tar passt-c638129a9e803388a37d95c4c411047571556109.tar.gz passt-c638129a9e803388a37d95c4c411047571556109.tar.bz2 passt-c638129a9e803388a37d95c4c411047571556109.tar.lz passt-c638129a9e803388a37d95c4c411047571556109.tar.xz passt-c638129a9e803388a37d95c4c411047571556109.tar.zst passt-c638129a9e803388a37d95c4c411047571556109.zip |
tests: Improve control character filtering in pane_parse
pane_parse() attempts to grab the output from the last command issued
into a tmux pane. It strips out control characters using tr, which in
particular includes the final \r\n. However, this won't fully strip
out terminal escape sequences. In particular this breaks if the shell
in the pane is bash, with enable-bracketed-paste enabled in readline.
That issues terminal sequences to enable and disable bracketed paste
mode around every shell prompt.
We can work around this because these escapes are followed by a \r
(CR). More generally, it seems reasonable to assume that any terminal
shenanigans followed by a CR, but not an LF is supposed to be hidden.
So, use sed to strip everything before the second last CR. We still
need the tr to remove the final \r\n from the string (sed processes a
line at a time, and doesn't consider the CRLF part of the buffer it's
processing).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[sbrivio: modify regexp to keep foo\r\r\n unchanged, by matching on at
least one CR and a non-CR afterwards: that's the usual output pattern
for bash on Debian 8 and Debian 9]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/distro/debian')
0 files changed, 0 insertions, 0 deletions