summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2019-10-02 23:04:09 (GMT)
committerGitHub <noreply@github.com>2019-10-02 23:04:09 (GMT)
commit3e04cd268ee9a57f95dc78d8974b21a6fac3f666 (patch)
treedeb874b6881f5695876fa09575da5a402d5a0e26 /Lib
parent61691d833631fed42b86605b09e1535e3e8d40e5 (diff)
downloadcpython-3e04cd268ee9a57f95dc78d8974b21a6fac3f666.zip
cpython-3e04cd268ee9a57f95dc78d8974b21a6fac3f666.tar.gz
cpython-3e04cd268ee9a57f95dc78d8974b21a6fac3f666.tar.bz2
bpo-36670, regrtest: Fix WindowsLoadTracker() for partial line (GH-16550)
WindowsLoadTracker.read_output() now uses a short buffer for incomplete line.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/libregrtest/win_utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/libregrtest/win_utils.py b/Lib/test/libregrtest/win_utils.py
index f0c17b9..f802980 100644
--- a/Lib/test/libregrtest/win_utils.py
+++ b/Lib/test/libregrtest/win_utils.py
@@ -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 @@ class WindowsLoadTracker():
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):