diff options
author | Ruben Rodriguez Buchillon <coconutruben@chromium.org> | 2021-04-06 19:14:38 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-22 17:59:20 +0000 |
commit | 06ecb87fcb9a62caf6831f13234568f9eeabee94 (patch) | |
tree | 7738f8184436ff052b6ed5c1a780e36ef8979d36 | |
parent | 8e1c9f34df52d1cbf615203435b185a5337845cf (diff) | |
download | chrome-ec-06ecb87fcb9a62caf6831f13234568f9eeabee94.tar.gz |
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 <coconutruben@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809883
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
(cherry picked from commit a18259036ddc0f1a2cf9673772ba03360aac3b74)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2846947
-rwxr-xr-x | util/ec3po/console.py | 2 |
1 files changed, 1 insertions, 1 deletions
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: |