MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / command_output

Function command_output

scripts/update_deps.py:315–333  ·  view source on GitHub ↗
(cmd, directory)

Source from the content-addressed store, hash-verified

313 os.makedirs(path)
314
315def command_output(cmd, directory):
316 # Runs a command in a directory and returns its standard output stream.
317 # Captures the standard error stream and prints it an error occurs.
318 # Raises a RuntimeError if the command fails to launch or otherwise fails.
319 if VERBOSE:
320 print('In {d}: {cmd}'.format(d=directory, cmd=cmd))
321
322 # errors='replace' affects only how the text output is decoded, and indicates that
323 # 8-bit characters that aren't recognized by the UTF decoder will be replaced with
324 # an "unknown character" glyph instead of crashing.
325 result = subprocess.run(cmd, cwd=directory, capture_output=True, text=True, errors='replace')
326
327 if result.returncode != 0:
328 print(f'{result.stderr}', file=sys.stderr)
329 raise RuntimeError(f'Failed to run {cmd} in {directory}')
330
331 if VERBOSE:
332 print(result.stdout)
333 return result.stdout
334
335def run_cmake_command(cmake_cmd):
336 # NOTE: Because CMake is an exectuable that runs executables

Callers 5

CloneMethod · 0.85
FetchMethod · 0.85
CheckoutMethod · 0.85
PreBuildMethod · 0.85
CustomBuildMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected