diff --git a/pylib/cqlshlib/test/run_cqlsh.py b/pylib/cqlshlib/test/run_cqlsh.py index a335735b09c4..f592cc078f28 100644 --- a/pylib/cqlshlib/test/run_cqlsh.py +++ b/pylib/cqlshlib/test/run_cqlsh.py @@ -249,6 +249,7 @@ def read_until(self, until, blksize=4096, timeout=None, cqlshlog.debug("Searching for %r" % (until.pattern,)) got = self.readbuf self.readbuf = '' + empty_reads = 0 with timing_out(timeout): while True: val = self.read(blksize, ptty_timeout) @@ -257,7 +258,13 @@ def read_until(self, until, blksize=4096, timeout=None, val = val.replace(replace_target, '') cqlshlog.debug("read %r from subproc" % (val,)) if val == '': - raise EOFError("'until' pattern %r not found" % (until.pattern,)) + empty_reads += 1 + if empty_reads > 1: + raise EOFError("'until' pattern %r not found" % (until.pattern,)) + # Read again to allow decoding of UTF-8 characters that span multiple reads + continue + + empty_reads = 0 got += val m = until.search(got) if m is not None: