deploy_tools.external_tools#

Members

ExternalToolError

Raised when a required external command-line tool is missing or fails.

run_command

Run an external command, surfacing tool problems as clean domain errors.

exception deploy_tools.external_tools.ExternalToolError[source]#

Raised when a required external command-line tool is missing or fails.

deploy_tools.external_tools.run_command(command: list[str | Path], *, check: bool = False, capture_output: bool = False, text: bool = False) CompletedProcess[Any][source]#

Run an external command, surfacing tool problems as clean domain errors.

Wraps subprocess.run so that a missing executable (or, when check is set, a non-zero exit) is reported as an ExternalToolError rather than a raw FileNotFoundError/CalledProcessError traceback.

Parameters:
  • command – The command to run, as a list whose first element is the executable.

  • check – If True, raise when the command exits with a non-zero status.

  • capture_output – If True, capture the command’s stdout and stderr.

  • text – If True, decode captured output as text rather than bytes.

Returns:

The subprocess.CompletedProcess for the finished command.

Raises:

ExternalToolError – If the executable cannot be found, or check is set and the command exits with a non-zero status.