From 59baed5d54c3735f1bb598de775f7bd1be63e933 Mon Sep 17 00:00:00 2001 From: Evan Date: Mon, 27 Nov 2023 21:10:53 +1100 Subject: [PATCH] Work around trailing null characters in zsh (#465) --- test/test.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/test.py b/test/test.py index d94e55a..b0db14e 100755 --- a/test/test.py +++ b/test/test.py @@ -54,7 +54,11 @@ def run_command(self, command, **kwargs): raise Exception("Expected to see a newline in command response") echo_cmd, actual_res = res.split("\n", 1) res_without_ansi_seqs = re.sub(r"\x1b\[0m.+\x1b\[J", "", actual_res) - return res_without_ansi_seqs + # Unsure why some environments produce trailing null characters, + # but they break tests and trimming them seems to be harmless. + # https://github.com/kislyuk/argcomplete/issues/447 + res_without_null_chars = res_without_ansi_seqs.rstrip("\x00") + return res_without_null_chars else: return res