Show / Hide Table of Contents

Class Process

A class that represents a Windows Process. Similar to System.Diagnostics.Process, but not intended as a complete replacement.

Inheritance
System.Object
Process
Implements
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Fs.Processes
Assembly: Fs.Processes.dll
Syntax
public sealed class Process : IDisposable

Constructors

| Improve this Doc View Source

Process(CreateProcessInfo)

Creates a new process and assigns the process to the job object.

Declaration
public Process(CreateProcessInfo createProcessInfo)
Parameters
Type Name Description
CreateProcessInfo createProcessInfo

The CreateProcessInfo that contains information this is used to start the process, including the file name and any command-line arguments.

| Improve this Doc View Source

Process(CreateProcessInfo, ProcessOptions)

Creates a new process and assigns the process to the job object.

Declaration
public Process(CreateProcessInfo createProcessInfo, ProcessOptions processOptions)
Parameters
Type Name Description
CreateProcessInfo createProcessInfo

The CreateProcessInfo that contains information this is used to start the process, including the file name and any command-line arguments.

ProcessOptions processOptions

A set of ProcessOptions that controls how the new process is created.

Properties

| Improve this Doc View Source

ExitCode

Gets the value associated with the process when it exited, or null if the process has not exited.

Declaration
public int? ExitCode { get; }
Property Value
Type Description
System.Nullable<System.Int32>
| Improve this Doc View Source

Exited

Gets a System.Threading.Tasks.Task that completes when the process exits. The System.Threading.Tasks.Task is cancelled if the Process is disposed before the process exits.

Declaration
public Task<int> Exited { get; }
Property Value
Type Description
System.Threading.Tasks.Task<System.Int32>
| Improve this Doc View Source

Handle

Gets the Microsoft.Win32.SafeHandles.SafeProcessHandle associated with this instance.

Declaration
public SafeProcessHandle Handle { get; }
Property Value
Type Description
Microsoft.Win32.SafeHandles.SafeProcessHandle
| Improve this Doc View Source

Id

Gets the unique identifier of the process.

Declaration
public int Id { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

StandardError

Gets a stream used to read from the redirected error output of the process.

Declaration
public StreamReader StandardError { get; }
Property Value
Type Description
System.IO.StreamReader
| Improve this Doc View Source

StandardInput

Gets a stream used to write to the redirected input of the proces.

Declaration
public StreamWriter StandardInput { get; }
Property Value
Type Description
System.IO.StreamWriter
| Improve this Doc View Source

StandardOutput

Gets a stream used to read from the redirected output of the process.

Declaration
public StreamReader StandardOutput { get; }
Property Value
Type Description
System.IO.StreamReader

Methods

| Improve this Doc View Source

BeginReadingStandardErrorAsync(Boolean)

Begins asynchronous read operations on the redirected StandardError stream of the process.

Declaration
public Task BeginReadingStandardErrorAsync(bool readAsLines = true)
Parameters
Type Name Description
System.Boolean readAsLines

When true data is buffered until a complete line is read, otherwise data is dispatched as it is received.

Returns
Type Description
System.Threading.Tasks.Task

A System.Threading.Tasks.Task that completes when all data has been read.

| Improve this Doc View Source

BeginReadingStandardOutputAsync(Boolean)

Begins asynchronous read operations on the redirected StandardOutput stream of the process.

Declaration
public Task BeginReadingStandardOutputAsync(bool readAsLines = true)
Parameters
Type Name Description
System.Boolean readAsLines

When true data is buffered until a complete line is read, otherwise data is dispatched as it is received.

Returns
Type Description
System.Threading.Tasks.Task

A System.Threading.Tasks.Task that completes when all data has been read.

| Improve this Doc View Source

CancelReadingStandardError()

Cancels the asynchronous read operation on the redirected StandardError stream of the process.

Declaration
public void CancelReadingStandardError()
| Improve this Doc View Source

CancelReadingStandardOutput()

Cancels the asynchronous read operation on the redirected StandardOutput stream of the process.

Declaration
public void CancelReadingStandardOutput()
| Improve this Doc View Source

Dispose()

Releases all resources used by the instance.

Declaration
public void Dispose()
| Improve this Doc View Source

Kill(Int32)

Immediately stops the process.

Declaration
public void Kill(int exitCode = -1)
Parameters
Type Name Description
System.Int32 exitCode

The value to be used as the process's exit code.

| Improve this Doc View Source

Resume()

Decrements the primary thread's suspend count. When the suspend count is decremented to zero, the execution of the thread is resumed.

Declaration
public bool Resume()
Returns
Type Description
System.Boolean

true if the thread is resumed; otherwise, false.

Events

| Improve this Doc View Source

ErrorDataReceived

Occurs each time a process writes data to its redirected StandardError stream.

Declaration
public event EventHandler<ProcessDataReceivedEventArgs> ErrorDataReceived
Event Type
Type Description
System.EventHandler<ProcessDataReceivedEventArgs>
| Improve this Doc View Source

OutputDataReceived

Occurs each time a process writes data to its redirected StandardOutput stream.

Declaration
public event EventHandler<ProcessDataReceivedEventArgs> OutputDataReceived
Event Type
Type Description
System.EventHandler<ProcessDataReceivedEventArgs>

Implements

System.IDisposable
  • Improve this Doc
  • View Source
Back to top Generated by DocFX