API Reference
The reference pages in this section are generated from the XML documentation in the source code, so they always match the shipped package; the table below is a map of where to start.
Invex.Process
| Type | Kind | Description |
|---|---|---|
IProcessRunner |
Interface | Injectable service for executing external processes. Exposes synchronous Run and asynchronous RunAsync. Registered as a singleton. |
ProcessRunOptions |
Record | Immutable configuration for a single execution: executable name, arguments, working directory, environment variables, log levels, per-line transforms, and failure tolerance. |
ProcessRunResult |
Record | The result of a completed execution: exit code, full captured stdout/stderr, and the originating options. |
ProcessException |
Exception | Thrown on a non-zero exit (unless AllowFailedResult is set); carries the exit code and the full ProcessRunResult. |
ProcessHostExtensions |
Static class | IServiceCollection extensions; call AddProcessRunner() once during host setup. |
Typical flow
- Register the runner with
AddProcessRunner()fromProcessHostExtensions. - Inject
IProcessRunnerwhere you need to shell out. - Build a
ProcessRunOptionsdescribing the invocation. - Call
RunorRunAsyncand use the returnedProcessRunResult.
var result = await processRunner.RunAsync(
new ProcessRunOptions("git", "rev-parse HEAD")
{
WorkingDirectory = repoRoot,
},
cancellationToken);
var commitSha = result.Output.Trim();
For conceptual documentation, see the Introduction; for what you can rely on between releases, see Versioning.