From 242c367ad64b275e372a66e1e6831b54905b60d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20E=C3=9Fer?= Date: Wed, 22 Sep 2021 17:26:08 +0200 Subject: Disable baacketed-paste mode in bash 5.1 and newer (issue #669) The bash versions starting with 5.1 have bracketed paste mode enabled by default, leading to test failures in replwrap.bash(), e.g.: self = def test_multiline(self): bash = replwrap.bash() res = bash.run_command("echo '1 2\n3 4'") > self.assertEqual(res.strip().splitlines(), ['1 2', '3 4']) E AssertionError: Lists differ: ['\x1b[?2004l', '\x1b[?2004h\x1b[?2004l', '1 2', '3 4', '\x1b[?2004h'] != ['1 2', '3 4'] E E First differing element 0: E '\x1b[?2004l' E '1 2' E E First list contains 3 additional elements. E First extra element 2: E '1 2' E E - ['\x1b[?2004l', '\x1b[?2004h\x1b[?2004l', '1 2', '3 4', '\x1b[?2004h'] E + ['1 2', '3 4'] With bracketed test mode disabled, the tests that were affected by the inserted escape sequences succeed. --- pexpect/bashrc.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pexpect/bashrc.sh') diff --git a/pexpect/bashrc.sh b/pexpect/bashrc.sh index c734ac9..d75d1a5 100644 --- a/pexpect/bashrc.sh +++ b/pexpect/bashrc.sh @@ -14,3 +14,5 @@ PS1="$" # Unset PROMPT_COMMAND, so that it can't change PS1 to something unexpected. unset PROMPT_COMMAND + +bind 'set enable-bracketed-paste off' -- cgit v1.2.1