civet.shells
Wrappers around
subprocess.run
.
1""" 2Wrappers around 3[`subprocess.run`](https://docs.python.org/3/library/subprocess.html#subprocess.run). 4""" 5 6import subprocess as sp 7from os import PathLike 8from typing import Sequence, Callable 9 10Shell = Callable[[Sequence[str | PathLike]], None] 11 12 13def subprocess_run(cmd: Sequence[str | PathLike]) -> None: 14 """ 15 Alias for `subprocess.run(cmd, check=True)` 16 """ 17 sp.run(cmd, check=True) 18 19 20def quiet(cmd: Sequence[str | PathLike]) -> None: 21 """ 22 Similar to `subprocess_run` but output streams are piped to `/dev/null`. 23 """ 24 sp.run(cmd, check=True, stdout=sp.DEVNULL, stderr=sp.STDOUT)
def
subprocess_run(cmd: Sequence[Union[str, os.PathLike]]) -> None:
14def subprocess_run(cmd: Sequence[str | PathLike]) -> None: 15 """ 16 Alias for `subprocess.run(cmd, check=True)` 17 """ 18 sp.run(cmd, check=True)
Alias for subprocess.run(cmd, check=True)
def
quiet(cmd: Sequence[Union[str, os.PathLike]]) -> None:
21def quiet(cmd: Sequence[str | PathLike]) -> None: 22 """ 23 Similar to `subprocess_run` but output streams are piped to `/dev/null`. 24 """ 25 sp.run(cmd, check=True, stdout=sp.DEVNULL, stderr=sp.STDOUT)
Similar to subprocess_run
but output streams are piped to /dev/null
.