Imp.ExternalCommand (Imp v0.5.0)

Copy Markdown View Source

Runs an executable with argv through Imp's shared process-group lifecycle.

The wrapper normalizes exit results and applies bounded redaction. It does not invoke a shell or implement a second process-management path.

Summary

Functions

Starts a managed process group and returns after its OS group identity is known.

Synchronously stops a managed process group and verifies that the group is gone.

Types

result()

@type result() :: %{
  exit_status: non_neg_integer() | :timeout,
  output: String.t(),
  duration_ms: non_neg_integer()
}

Functions

run(executable, argv, opts \\ [])

@spec run(String.t(), [String.t()], keyword()) :: {:ok, result()} | {:error, term()}

start(executable, argv, opts \\ [])

@spec start(String.t(), [String.t()], keyword()) ::
  {:ok, Imp.ExternalCommand.Handle.t()} | {:error, term()}

Starts a managed process group and returns after its OS group identity is known.

stop(handle, timeout \\ 10000)

@spec stop(Imp.ExternalCommand.Handle.t(), timeout()) :: :ok | {:error, term()}

Synchronously stops a managed process group and verifies that the group is gone.