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 02:54:44 +0000 |
commit | a18259036ddc0f1a2cf9673772ba03360aac3b74 (patch) | |
tree | 417bd50cf158ca27727d14323cd541c916a15b6f /util/ec3po | |
parent | 97f1427e200b70d0654d7391f45697f48d1a3d4c (diff) | |
download | chrome-ec-a18259036ddc0f1a2cf9673772ba03360aac3b74.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>
Diffstat (limited to 'util/ec3po')
-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: |