Util.Exec behaviour (fnord v0.9.36)

View Source

Seam over subprocess execution for outward-facing commands that have no dedicated facade of their own (git goes through GitCli; everything else that shells out to affect the world outside the BEAM - desktop notifications, escript installs - routes through this module). impl/0 resolves the :exec Globals key (same dispatch pattern as :http_client), defaulting to the System passthrough in the sibling Default module. Tests get the Mox mock with NO default stub, so a test that reaches an unscripted subprocess fails loudly instead of spawning one.

Summary

Callbacks

Runs executable with args. Mirrors System.cmd/3: returns the collected output and the exit status.

Resolves name on the PATH. Mirrors System.find_executable/1.

Callbacks

cmd(t, list, keyword)

@callback cmd(String.t(), [String.t()], keyword()) :: {Collectable.t(), non_neg_integer()}

Runs executable with args. Mirrors System.cmd/3: returns the collected output and the exit status.

find_executable(t)

@callback find_executable(String.t()) :: String.t() | nil

Resolves name on the PATH. Mirrors System.find_executable/1.

Functions

cmd(executable, args, opts \\ [])

@spec cmd(String.t(), [String.t()], keyword()) :: {Collectable.t(), non_neg_integer()}

find_executable(name)

@spec find_executable(String.t()) :: String.t() | nil

impl()