l.s.c.OutputLineHandler : class documentation

Part of lp.services.command_spawner View In Hierarchy

Collect and handle lines of output from a sub-process.

Output received from a sub-process may not be neatly broken down by line. This class collects them into lines and processes them one by one. If desired, it can also add a prefix to each.

Method __init__ Set up an output line handler.
Method process_line Process a single line of output.
Method __call__ Process multi-line output.
Method finalize Process the remaining incomplete line, if any.
def __init__(self, line_processor, prefix=''):
Set up an output line handler.
Parametersline_processorA callback to be invoked for each line of output received. Will receive exactly one argument: a single nonempty line of text, without the trailing newline.
prefixAn optional string to be prefixed to each line of output before it is sent into the line_processor.
def process_line(self, line):
Process a single line of output.
def __call__(self, output):
Process multi-line output.

Any trailing text not (yet) terminated with a newline is buffered.

def finalize(self):
Process the remaining incomplete line, if any.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.