Behaviour for running an external command and capturing its output.
The default implementation is LibclusterMesh.Runner.SystemCmd. Strategies
accept a :runner config key so tests (or exotic setups, e.g. querying a
daemon over HTTP instead of a CLI) can substitute their own implementation.
Implementations must never raise or exit: any failure — non-zero exit,
missing binary, timeout — is reported as {:error, message} so that the
poll loop survives and retries on the next interval. run/2 holds them to
that whether they keep it or not, because the strategies are entitled to
assume it and a poll loop taken down by a third-party runner is the one
failure this library promises cannot happen.
Summary
Callbacks
Runs cmd with args, returning its combined stdout/stderr output.
Functions
Runs args through the runner named in config and returns its output.
Types
Callbacks
@callback run(cmd :: String.t(), args :: [String.t()], timeout :: pos_integer()) :: result()
Runs cmd with args, returning its combined stdout/stderr output.
timeout is the maximum time in milliseconds to wait for the command.
Functions
@spec run(LibclusterMesh.Config.t(), [String.t()]) :: result()
Runs args through the runner named in config and returns its output.
The runner's answer is held to result/0: anything else, and any
exception or exit escaping the runner, comes back as {:error, message}
naming the runner, so that a strategy only ever has a string to parse or an
error to report.