File: impl_aep_protocol.py

package info (click to toggle)
ros-osrf-pycommon 2.1.7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 360 kB
  • sloc: python: 1,726; makefile: 146; xml: 16
file content (16 lines) | stat: -rw-r--r-- 507 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from osrf_pycommon.process_utils import AsyncSubprocessProtocol


def create_protocol():
    class CustomProtocol(AsyncSubprocessProtocol):
        def __init__(self, **kwargs):
            self.stdout_buffer = b""
            self.stderr_buffer = b""
            AsyncSubprocessProtocol.__init__(self, **kwargs)

        def on_stdout_received(self, data):
            self.stdout_buffer += data

        def on_stderr_received(self, data):
            self.stderr_buffer += data
    return CustomProtocol