From 1ee64091b3411b145721e1bfe3848beb17fc3b3d Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 25 May 2021 18:22:20 +0200 Subject: [PATCH] Fix extauth.py failure in test suite with Python 3 (#3612) --- test/ejabberd_SUITE_data/extauth.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/ejabberd_SUITE_data/extauth.py b/test/ejabberd_SUITE_data/extauth.py index b6a217fcc..394c2126a 100755 --- a/test/ejabberd_SUITE_data/extauth.py +++ b/test/ejabberd_SUITE_data/extauth.py @@ -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':