ExternalProgramComponentStartProcess Method

Attempts to start the file described by ComponentInfo as an executable process. Optionally sets up cancellation.

Definition

Namespace: Quine.Schemas.Core
Assembly: Quine.Schemas.Core (in Quine.Schemas.Core.dll) Version: 1.0.0+0ea0706914ee4edf2b0ed66bec3ab4d062a43b68
C#
public ExternalProgramComponentCancellableProcess StartProcess(
	ProcessStartInfo psi,
	Action<Process> configure,
	CancellationToken ct = default,
	Action<Process> cancel = null
)

Parameters

psi  ProcessStartInfo
Startup info for the process. The file path is ignored and overwritten by that in ComponentInfo. UseShellExecute is unconditionally set to false.
configure  ActionProcess
If not null, the action invoked to further configure the process instance before it's started. (For example, setting up stdio events.) The argument passed to the action is the created process, which is the same instance as the returned value. The action must not throw.
ct  CancellationToken  (Optional)
Cancellation token that triggers cancel, which must also be provided together with the token.
cancel  ActionProcess  (Optional)
Action to shut down the started process when cancel is signalled. The action must not throw.

Return Value

ExternalProgramComponentCancellableProcess
A started process instance.

Exceptions

ExternalProgramComponentException Wraps any exception that occurred during process startup.
OperationCanceledException Cancellation was detected immediately before or after the process has started. In the latter case, cancel action is run before the exception is thrown.

See Also