MCPcopy Create free account
hub / github.com/ipython/traitlets / get_output_error_code

Function get_output_error_code

traitlets/tests/utils.py:9–15  ·  view source on GitHub ↗

Get stdout, stderr, and exit code from running a command

(cmd: str | Sequence[str])

Source from the content-addressed store, hash-verified

7
8
9def get_output_error_code(cmd: str | Sequence[str]) -> tuple[str, str, Any]:
10 """Get stdout, stderr, and exit code from running a command"""
11 p = Popen(cmd, stdout=PIPE, stderr=PIPE) # noqa: S603
12 out, err = p.communicate()
13 out_str = out.decode("utf8", "replace")
14 err_str = err.decode("utf8", "replace")
15 return out_str, err_str, p.returncode
16
17
18def check_help_output(pkg: str, subcommand: Sequence[str] | None = None) -> tuple[str, str]:

Callers 4

test_show_config_cliFunction · 0.90
check_help_outputFunction · 0.85
check_help_all_outputFunction · 0.85

Calls

no outgoing calls

Tested by 2

test_show_config_cliFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…