capture: don't assume that the tmpfile is backed by a BytesIO

Since tmpfile is a parameter to SysCapture, it shouldn't assume things
unnecessarily, when there is an alternative.
This commit is contained in:
Ran Benita 2020-04-16 20:59:27 +03:00
parent 97bcf5a3a2
commit fd3ba053cf
1 changed files with 2 additions and 1 deletions

View File

@ -281,7 +281,8 @@ class SysCaptureBinary:
self._state = "started" self._state = "started"
def snap(self): def snap(self):
res = self.tmpfile.buffer.getvalue() self.tmpfile.seek(0)
res = self.tmpfile.buffer.read()
self.tmpfile.seek(0) self.tmpfile.seek(0)
self.tmpfile.truncate() self.tmpfile.truncate()
return res return res