Commit 3e04cd26 authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

bpo-36670, regrtest: Fix WindowsLoadTracker() for partial line (GH-16550)

WindowsLoadTracker.read_output() now uses a short buffer for
incomplete line.
parent 61691d83
...@@ -32,6 +32,7 @@ class WindowsLoadTracker(): ...@@ -32,6 +32,7 @@ class WindowsLoadTracker():
def __init__(self): def __init__(self):
self.load = 0.0 self.load = 0.0
self.counter_name = '' self.counter_name = ''
self._buffer = b''
self.popen = None self.popen = None
self.start() self.start()
...@@ -100,7 +101,9 @@ class WindowsLoadTracker(): ...@@ -100,7 +101,9 @@ class WindowsLoadTracker():
if res != 0: if res != 0:
return return
output = overlapped.getbuffer() # self._buffer stores an incomplete line
output = self._buffer + overlapped.getbuffer()
output, _, self._buffer = output.rpartition(b'\n')
return output.decode('oem', 'replace') return output.decode('oem', 'replace')
def getloadavg(self): def getloadavg(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment