mirror of https://github.com/python/cpython.git
bpo-36670, regrtest: Fix WindowsLoadTracker() for partial line (GH-16550)
WindowsLoadTracker.read_output() now uses a short buffer for incomplete line.
This commit is contained in:
parent
61691d8336
commit
3e04cd268e
|
@ -32,6 +32,7 @@ class WindowsLoadTracker():
|
|||
def __init__(self):
|
||||
self.load = 0.0
|
||||
self.counter_name = ''
|
||||
self._buffer = b''
|
||||
self.popen = None
|
||||
self.start()
|
||||
|
||||
|
@ -100,7 +101,9 @@ def read_output(self):
|
|||
if res != 0:
|
||||
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')
|
||||
|
||||
def getloadavg(self):
|
||||
|
|
Loading…
Reference in New Issue