Table of Contents

Interface IProcess

Namespace
GroupeIsa.Neos.Shared.IO
Assembly
GroupeIsa.Neos.Shared.dll

Enables you to start and stop local system processes.

public interface IProcess : IDisposable
Inherited Members

Properties

ExitCode

Gets the value that the associated process specified when it terminated.

int ExitCode { get; }

Property Value

int

Id

Gets the unique identifier for the associated process.

int Id { get; }

Property Value

int

IsRunning

Gets a value indicating whether the associated Process is running.

bool IsRunning { get; }

Property Value

bool

StandardError

Gets a stream used to read the error of the application.

StreamReader StandardError { get; }

Property Value

StreamReader

A StreamReader that can be used to read the standard error stream of the application.

StandardInput

Gets a stream used to write the input of the application.

StreamWriter StandardInput { get; }

Property Value

StreamWriter

A StreamWriter that can be used to write the standard input stream of the application.

StandardOutput

Gets a stream used to read the output of the application.

StreamReader StandardOutput { get; }

Property Value

StreamReader

A StreamReader that can be used to read the standard output stream of the application.

StartInfo

Gets or sets the properties to pass to the Start() method of the Process.

ProcessStartInfo StartInfo { get; set; }

Property Value

ProcessStartInfo

StartTime

Gets the time that the associated process was started.

DateTime StartTime { get; }

Property Value

DateTime

Methods

BeginErrorReadLine()

Begins asynchronous read operations on the redirected StandardError property of this Process component.

void BeginErrorReadLine()

BeginOutputReadLine()

Begins asynchronous read operations on the redirected StandardOutput property of this Process component.

void BeginOutputReadLine()

CloseMainWindow()

Closes a process that has a user interface by sending a close message to its main window.

bool CloseMainWindow()

Returns

bool

true if the close message was successfully sent; false if the associated process does not have a main window or if the main window is disabled (for example if a modal dialog is being shown).

Kill(bool)

Immediately stops the associated process, and optionally its child/descendent processes.

void Kill(bool entireProcessTree)

Parameters

entireProcessTree bool

true to kill the associated process and its descendants; false to kill only the associated process.

Start()

Starts the process resource that is specified by the StartInfo property of this Process component.

bool Start()

Returns

bool

true if a process resource is started; otherwise, false.

WaitForExit()

Instructs the process component to wait for the associated process to exit.

void WaitForExit()

WaitForExitAsync(CancellationToken)

Instructs the process component to wait for the associated process to exit, or for the cancellationToken to be cancelled.

Task WaitForExitAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

An optional token to cancel the asynchronous operation.

Returns

Task

A task that will complete when the process has exited, cancellation has been requested, or an error occurs.

Events

ErrorDataReceived

Occurs when an application writes to its redirected StandardError stream.

event EventHandler<DataReceivedWrapperEventArgs>? ErrorDataReceived

Event Type

EventHandler<DataReceivedWrapperEventArgs>

Exited

Occurs when a Process exits.

event EventHandler? Exited

Event Type

EventHandler

OutputDataReceived

Occurs each time an application writes a line to its redirected StandardOutput stream.

event EventHandler<DataReceivedWrapperEventArgs>? OutputDataReceived

Event Type

EventHandler<DataReceivedWrapperEventArgs>