ProcessInstance Class

Represents a running process. Resources are released automatically when the process exits. Await to wait for exit and get a ProcessResult.

public class ProcessInstance

Properties

NameDescription
ProcessIdGets the process ID.
StartDateGets the time the process was started.

Gets the process ID.

public int ProcessId { get; }

Property value

int

Gets the time the process was started.

public DateTimeOffset StartDate { get; }

Property value

DateTimeOffset

Methods

NameDescription
ConfigureAwait(bool)Configures whether to marshal continuations back to the captured context.
ConfigureAwait(ConfigureAwaitOptions)Configures how awaits on this instance are performed.
GetAwaiter()Gets an awaiter that waits for the process to exit and returns the process result.
Kill(bool)Kills the process.
Signal(PosixSignal)Sends a signal to the process.
UnsafeGetProcessHandle()Gets the handle to the process. Returns null once the process has exited and resources were released.

ConfigureAwait overloads

ConfigureAwait(bool)

ProcessInstance.cs

Configures whether to marshal continuations back to the captured context.

public ConfiguredTaskAwaitable<ProcessResult> ConfigureAwait(bool continueOnCapturedContext)
Parameters
continueOnCapturedContext bool
Returns

ConfiguredTaskAwaitable<ProcessResult>

ConfigureAwait(ConfigureAwaitOptions)

ProcessInstance.cs

Configures how awaits on this instance are performed.

GetAwaiter()

ProcessInstance.cs

Gets an awaiter that waits for the process to exit and returns the process result.

public TaskAwaiter<ProcessResult> GetAwaiter()

Kills the process.

public void Kill(bool entireProcessTree = true)

Parameters

entireProcessTree bool

Signal(PosixSignal)

ProcessInstance.cs

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

  • Supported on maccatalyst
  • Not supported on ios
  • Not supported on tvos

Sends a signal to the process.

[SupportedOSPlatform("maccatalyst")]
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
public bool Signal(PosixSignal signal)

Parameters

signal PosixSignal

Returns

bool

UnsafeGetProcessHandle()

ProcessInstance.cs

Gets the handle to the process. Returns null once the process has exited and resources were released.

public SafeProcessHandle? UnsafeGetProcessHandle()