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>
This commit is contained in:
parent
3238232fc4
commit
9c27118c20
@ -25,8 +25,12 @@ def pipe(sfd, dfd):
|
|||||||
if dfd == STDOUT:
|
if dfd == STDOUT:
|
||||||
# Work around platform quirks. Some platforms echo ^D as \x04
|
# Work around platform quirks. Some platforms echo ^D as \x04
|
||||||
# (AIX, BSDs) and some don't (Linux).
|
# (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 = filter(filt, data)
|
||||||
|
data = bytes(data)
|
||||||
|
|
||||||
while data:
|
while data:
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user