IProcessRunner Interface

Runs a child process, waits for it to exit, and returns its outcome.

This type is not available in the netstandard and .NET Framework builds of Louis, as ProcessRunner is not.

public interface IProcessRunner

Methods

NameDescription
RunAsync(string, IEnumerable<string>, ProcessRunOptions?, CancellationToken)Asynchronously runs a child process and waits for it to exit.

RunAsync(string, IEnumerable<string>, ProcessRunOptions?, CancellationToken)

Available in: net10.0net11.0(not available in the other target frameworks of the package)

Asynchronously runs a child process and waits for it to exit.

Task<ProcessResult> RunAsync(string executable, IEnumerable<string> arguments, ProcessRunOptions? options = null, CancellationToken cancellationToken = default)

Parameters

executable string
The name or the path of the program to run.
arguments IEnumerable<string>
The arguments of the program. Each item reaches the program as one argument, whatever characters it holds.
options ProcessRunOptions?
The options of the run, or null to use the default value of every option.
cancellationToken CancellationToken
A CancellationToken that, when signaled, ends the run.

Returns

Task<ProcessResult> A Task<TResult> whose result describes the outcome of the run.

Exceptions

ArgumentNullException
executable is null. - or - arguments is null.
ArgumentException
arguments holds a null item.
ProcessFailedException
The process exited with a code other than 0, and ProcessRunOptions.ThrowOnNonZeroExitCode is true.
OperationCanceledException
cancellationToken was signaled before the run ended.