pygacity.util.command module

Simple command runner

class pygacity.util.command.Command(command: str, ignore_codes: list[int] = [], timeout: int = 120, env: dict = None, cwd: str = None, **options)[source]

Bases: object

run()[source]

Runs the command and returns the output and error messages.

Raises:
  • subprocess.TimeoutExpired – if the process does not finish within self.timeout seconds; the process is killed before the exception propagates

  • subprocess.SubprocessError – if the process exits with a non-zero return code that is not in self.ignore_codes