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 IProcessRunnerSee also
Methods
| Name | Description |
|---|---|
| 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
executablestring- The name or the path of the program to run.
argumentsIEnumerable<string>- The arguments of the program. Each item reaches the program as one argument, whatever characters it holds.
optionsProcessRunOptions?- The options of the run, or
nullto use the default value of every option. cancellationTokenCancellationToken- A
CancellationTokenthat, when signaled, ends the run.
Returns
Task<ProcessResult> A Task<TResult> whose result describes the outcome of the run.
Exceptions
ArgumentNullExceptionexecutableisnull. - or -argumentsisnull.ArgumentExceptionargumentsholds anullitem.ProcessFailedException- The process exited with a code other than 0, and
ProcessRunOptions.ThrowOnNonZeroExitCodeistrue. OperationCanceledExceptioncancellationTokenwas signaled before the run ended.