Class ProcessRunner
This class is used to run a process and capture the output. It is a wrapper around the System.Diagnostics.Process class.
Inherited Members
Namespace: Benday.Common
Assembly: Benday.Common.dll
Syntax
public class ProcessRunner
Constructors
| Edit this page View SourceProcessRunner(ProcessStartInfo)
Declaration
public ProcessRunner(ProcessStartInfo startInfo)
Parameters
Type | Name | Description |
---|---|---|
ProcessStartInfo | startInfo |
Properties
| Edit this page View SourceErrorText
The error text from the process. This is the standard error from the process.
Declaration
public string ErrorText { get; }
Property Value
Type | Description |
---|---|
string |
HasCompleted
Indicates if the process has completed. This is true if the process has completed with an error or successfully.
Declaration
public bool HasCompleted { get; }
Property Value
Type | Description |
---|---|
bool |
IsError
Indicates if the process completed with an error.
Declaration
public bool IsError { get; }
Property Value
Type | Description |
---|---|
bool |
IsSuccess
Indicates if the process completed successfully.
Declaration
public bool IsSuccess { get; }
Property Value
Type | Description |
---|---|
bool |
IsTimeout
Indicates if the process timed out.
Declaration
public bool IsTimeout { get; }
Property Value
Type | Description |
---|---|
bool |
OutputText
The output text from the process. This is the standard output from the process.
Declaration
public string OutputText { get; }
Property Value
Type | Description |
---|---|
string |
StartInfo
The ProcessStartInfo object that is used to start the process. This object is used to configure the process start info before running.
Declaration
public ProcessStartInfo StartInfo { get; }
Property Value
Type | Description |
---|---|
ProcessStartInfo |
Timeout
The timeout in milliseconds for the process to run. The default timeout is 10 seconds.
Declaration
public int Timeout { get; set; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceRun()
Run the command
Declaration
public void Run()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | |
TimeoutException |