subproc
subproc#
- showyourwork.subproc.get_stdout(args, shell=False, cwd=None, secrets=[], callback=<function process_run_result>)#
A thin wrapper around
subprocess.run
that hides secrets and decodesstdout
andstderr
output intoutf-8
.- Parameters
args (list or str) – Arguments passed to
subprocess.run
shell (bool, optional) – Passed directly to
subprocess.run
cwd (str, optional) – Directory to run the command in, if different from current working directory.
secrets (list, optional) – Secrets to be masked in the output.
callback (callable, optional) – Callback to process the result.
- showyourwork.subproc.parse_request(r)#
Parse a requests return object
r
and raise a custom exception for a >200-level status code.
- showyourwork.subproc.process_run_result(code, stdout, stderr)#
Default callback function for
get_stdout
.