datalad_next.shell.FixedLengthResponseGenerator

class datalad_next.shell.FixedLengthResponseGenerator(stdout: OutputFrom, length: int)[source]

Bases: ShellCommandResponseGenerator

Response generator for efficient handling of outputs of known length

This response generator is used to execute commands that have an output of known length. The final command list it creates will execute the command and print the return code followed by a newline.

The send()-method of this response generator will read the specified number of bytes and a trailing return code. This is more performant than scanning the output for an end-marker.

send(_) bytes[source]

Deliver the next part of generated output

Whenever the response generator is iterated over, this method is called and should deliver the next part of the command output or raise StopIteration if the command has finished.