

def _read_proc_stdout(self):
    'reads the burp process stdout and returns a document or None'
    doc = ''
    js = None
    while True:
        try:
            if (not self._proc_is_alive()):
                raise Exception('process died while reading its output')
            (r, _, _) = select([self.proc.stdout], [], [], self.timeout)
            if (self.proc.stdout not in r):
                raise TimeoutError('Read operation timed out')
            doc += self.proc.stdout.readline().rstrip('\n')
            js = self._is_valid_json(doc)
            if (js and self._is_ignored(js)):
                doc = ''
                continue
            elif js:
                break
        except (TimeoutError, IOError, Exception) as e:
            self._logger('warning', str(e))
            self._kill_burp()
            break
    return js

dataset/ETHPy150Open ziirish/burp-ui/burpui/misc/backend/burp2.py Burp._read_proc_stdout/original