Logo ProcessKit API Reference

IProcessRunner Type

The seam through which commands run to completion: three low-level primitives an implementer or mock provides. The public verb vocabulary (`RunAsync`/`OutputStringAsync`/`ExitCodeAsync`/… on a `Command`, a runner, a `CliClient`, or a `Pipeline`) is layered on top of these by the `Runner` module and its extension methods — so the primitives are named distinctly (`Capture*`/`Spawn`) and never collide with the verbs. (That collision used to force the capture verbs to silently drop the retry policy when called with a `CancellationToken`; with distinct names each verb is a single method taking an optional `CancellationToken` that retries uniformly whether or not a token is passed.) The default runner spawns real processes into a kill-on-drop group; test doubles (`ProcessKit.Testing.ScriptedRunner`) script replies with no subprocess. This interface is both the dependency-injection point and the test seam, so any .NET consumer can implement or mock it with plain `Task`-returning methods.

Instance members

Instance member Description

this.CaptureBytesAsync

Full Usage: this.CaptureBytesAsync

Parameters:
Returns: Task<Result<ProcessResult<byte[]>, ProcessError>>
Modifiers: abstract

Run to completion, capturing stdout as raw bytes. (The primitive behind the `OutputBytesAsync` verb.)

command : Command
cancellationToken : CancellationToken
Returns: Task<Result<ProcessResult<byte[]>, ProcessError>>

this.CaptureStringAsync

Full Usage: this.CaptureStringAsync

Parameters:
Returns: Task<Result<ProcessResult<string>, ProcessError>>
Modifiers: abstract

Run to completion, capturing stdout as decoded text. A non-zero exit is reported in the `ProcessResult`, not raised as an error. (The primitive behind the `OutputStringAsync` verb.)

command : Command
cancellationToken : CancellationToken
Returns: Task<Result<ProcessResult<string>, ProcessError>>

this.SpawnAsync

Full Usage: this.SpawnAsync

Parameters:
Returns: Task<Result<RunningProcess, ProcessError>>
Modifiers: abstract

Start the command and return a live handle for streaming, interactive stdin, and waiting. (The primitive behind the `StartAsync` verb.) `cancellationToken` is checked exactly **once**, before the spawn: an already-cancelled token reports `ProcessError.Cancelled` without starting a child. Once the child is running the token is **no longer tracked** — a live handle is caller-driven, so cancel or reap it yourself (dispose the handle, or call its `Kill`). This differs from the completion primitives (`CaptureStringAsync`/`CaptureBytesAsync`), which drive the child to completion and so honour the token — and the command's `CancelOn` — for the whole run.

command : Command
cancellationToken : CancellationToken
Returns: Task<Result<RunningProcess, ProcessError>>

Type something to start searching.