From a18259036ddc0f1a2cf9673772ba03360aac3b74 Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Buchillon Date: Tue, 6 Apr 2021 19:14:38 -0700 Subject: console: make sure eol check runs in python3 Indexing into a byte array returns an integer, which will return False when compared to a byte-array. This change makes sure we're comparing two characters (python2) or two integers (python3) BRANCH=None BUG=b:183642673 TEST=python3 b'hello\n'[-1]==b'\n' False TEST=python2.7 b'hello\n'[-1]==b'\n' True TEST=python3 b'hello\n'[-1]==b'\n'[0] True Change-Id: I26a4b1bde7acf733faae7ec355da228d76e261d0 Signed-off-by: Ruben Rodriguez Buchillon Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809883 Reviewed-by: Mary Ruthven Tested-by: Mary Ruthven --- util/ec3po/console.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/ec3po/console.py b/util/ec3po/console.py index 290ca214ac..185ad22b40 100755 --- a/util/ec3po/console.py +++ b/util/ec3po/console.py @@ -1065,7 +1065,7 @@ def StartLoop(console, command_active, shutdown_pipe=None): data_tm = data # timestamp required on next input - if data[end] == b'\n': + if data[end] == b'\n'[0]: tm_req = True os.write(console.master_pty, data_tm) if command_active.value: -- cgit v1.2.1