Skip to content

Commit

Permalink
tools: make pty_helper.py python3-compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Aug 16, 2019
1 parent 18405e6 commit 08b2308
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/pseudo-tty/pty_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 08b2308

Please sign in to comment.