confattr.subprocess_pipe module

confattr.subprocess_pipe.run_and_pipe(cmds: Sequence[str], *, get_output: bool = False, env: Optional[Mapping[str, str]] = None) CompletedProcess[bytes]

Run an external program and return when the program is finished.

Parameters:
  • cmds – One or several commands to be executed. If several commands are passed they are seperated by a ‘|’ and stdout of the former command is piped to stdin of the following command.

  • env – The environment variables to be passed to the subprocess. If env is None os.environ is used.

  • get_output – Make stdout and stderr available in the returned completed process object.

Returns:

The completed process

Raises:
  • OSError – e.g. if the program was not found

  • CalledProcessError – if the called program failed

https://docs.python.org/3/library/subprocess.html#exceptions

confattr.subprocess_pipe.split_list(l: Sequence[T], sep: T) Sequence[Sequence[T]]

Like str.split but for lists/tuples. Splits a sequence into several sequences.