summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2019-08-16 20:53:32 +0200
committerRich Trott <rtrott@gmail.com>2019-08-19 09:56:35 -0700
commit9c27118c20cf63de7637092955e5e41de7aa3316 (patch)
treeb3fafce61ce1aab65f40f7f82c963b17dd8787aa
parent3238232fc46f6a8cc0dc1323aba762247c464e5e (diff)
downloadandroid-node-v8-9c27118c20cf63de7637092955e5e41de7aa3316.tar.gz
android-node-v8-9c27118c20cf63de7637092955e5e41de7aa3316.tar.bz2
android-node-v8-9c27118c20cf63de7637092955e5e41de7aa3316.zip
tools: make pty_helper.py python3-compatible
Fixes: https://github.com/nodejs/node/issues/29166 PR-URL: https://github.com/nodejs/node/pull/29167 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
-rw-r--r--test/pseudo-tty/pty_helper.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/pseudo-tty/pty_helper.py b/test/pseudo-tty/pty_helper.py
index bf62e3f205..a61ef1cc0e 100644
--- a/test/pseudo-tty/pty_helper.py
+++ b/test/pseudo-tty/pty_helper.py
@@ -25,8 +25,12 @@ def pipe(sfd, dfd):
if dfd == STDOUT:
# Work around platform quirks. Some platforms echo ^D as \x04
# (AIX, BSDs) and some don't (Linux).
- filt = lambda c: ord(c) > 31 or c in '\t\n\r\f'
+ #
+ # The comparison against b' '[0] is because |data| is
+ # a string in python2 but a bytes object in python3.
+ filt = lambda c: c >= b' '[0] or c in b'\t\n\r\f'
data = filter(filt, data)
+ data = bytes(data)
while data:
try: