datalad.cmd

Wrapper for command and function calls, allowing for dry runs and output handling

class datalad.cmd.BatchedCommand(cmd, path=None, output_proc=None)[source]

Bases: datalad.cmd.SafeDelCloseMixin

Container for a process which would allow for persistent communication

close(return_stderr=False)[source]

Close communication and wait for process to terminate

Returns:stderr output if return_stderr and stderr file was there. None otherwise
Return type:str
proc1(arg)[source]

Same as __call__, but only takes a single command argument

and returns a single result.

yield_(cmds)[source]

Same as __call__, but requires cmds to be an iterable

and yields results for each item.

class datalad.cmd.SafeDelCloseMixin[source]

Bases: object

A helper class to use where __del__ would call .close() which might fail if “too late in GC game”

datalad.cmd.readline_rstripped(stdout)[source]