Fix extauth.py failure in test suite with Python 3 (#3612)

This commit is contained in:
Badlop 2021-05-25 18:22:20 +02:00
parent 7b33499811
commit 1ee64091b3
1 changed files with 7 additions and 1 deletions

View File

@ -1,8 +1,14 @@
import sys
import struct
def read_from_stdin(bytes):
if hasattr(sys.stdin, 'buffer'):
return sys.stdin.buffer.read(bytes)
else:
return sys.stdin.read(bytes)
def read():
(pkt_size,) = struct.unpack('>H', sys.stdin.read(2))
(pkt_size,) = struct.unpack('>H', read_from_stdin(2))
pkt = sys.stdin.read(pkt_size)
cmd = pkt.split(':')[0]
if cmd == 'auth':