myke.run¶
Functions that wrap around
subprocess.run
for added convenience.
Functions¶
run ¶
run(args: str | Sequence[str], capture_output: None | bool = False, echo: bool | None = True, check: bool | None = True, env: dict[str, str] | None = None, env_update: dict[str, str | None] | None = None, shell: bool | None = None, **kwargs: Any) -> subprocess.CompletedProcess[bytes | str]
Thin wrapper around subprocess.run
PARAMETER | DESCRIPTION |
---|---|
args
|
...
TYPE:
|
capture_output
|
...
TYPE:
|
echo
|
...
TYPE:
|
check
|
...
TYPE:
|
env
|
...
TYPE:
|
env_update
|
...
TYPE:
|
shell
|
...
TYPE:
|
**kwargs
|
passed to
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CompletedProcess[bytes | str]
|
... |
Examples:
>>> import myke
...
>>> myke.run(["python", "-c", "print('Hello World.')"])
CompletedProcess(args=['python', '-c', "print('Hello World.')"], returncode=0)
>>> myke.run("echo 'Hello World.'")
CompletedProcess(args="echo 'Hello World.'", returncode=0)
>>> p = myke.run("echo 'Hello World.'", capture_output=True, echo=False)
>>> p.stdout
b'Hello World.\n'
>>> p = myke.run("exit 123", check=False)
>>> p.returncode
123
sh ¶
sh(*args: Any, **kwargs: Any) -> subprocess.CompletedProcess[bytes | str]
Shorthand for: myke.run(..., shell=True)
PARAMETER | DESCRIPTION |
---|---|
*args
|
...
TYPE:
|
**kwargs
|
...
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CompletedProcess[bytes | str]
|
... |