datalad_next.shell.VariableLengthResponseGenerator

class datalad_next.shell.VariableLengthResponseGenerator(stdout: OutputFrom)[source]

Bases: ShellCommandResponseGenerator

Response generator that handles outputs of unknown length

This response generator is used to execute a command that will result in an output of unknown length, e.g. ls. The final command list it creates will execute the command and print a random end-marker and the return code after the output of the command. The send()-method of this class uses the end-marker to determine then end of the command output.

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.

abstract property zero_command: bytes

Return a command that functions as "zero command"