MCPcopy Create free account
hub / github.com/ModalityDance/Omni-R1 / run_command

Function run_command

src/transformers/src/transformers/testing_utils.py:2145–2159  ·  view source on GitHub ↗

Runs `command` with `subprocess.check_output` and will potentially return the `stdout`. Will also properly capture if an error occured while running `command`

(command: List[str], return_stdout=False)

Source from the content-addressed store, hash-verified

2143
2144
2145def run_command(command: List[str], return_stdout=False):
2146 """
2147 Runs `command` with `subprocess.check_output` and will potentially return the `stdout`. Will also properly capture
2148 if an error occured while running `command`
2149 """
2150 try:
2151 output = subprocess.check_output(command, stderr=subprocess.STDOUT)
2152 if return_stdout:
2153 if hasattr(output, "decode"):
2154 output = output.decode("utf-8")
2155 return output
2156 except subprocess.CalledProcessError as e:
2157 raise SubprocessCallException(
2158 f"Command `{' '.join(command)}` failed with the following error:\n\n{e.output.decode()}"
2159 ) from e
2160
2161
2162class RequestCounter:

Calls 3

check_outputMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected