Class ProcessRunner
Provides simple process invocation and output capture functionality
Inheritance
System.Object
ProcessRunner
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: NFX.dll
Syntax
public sealed class ProcessRunner
Constructors
ProcessRunner()
Declaration
Properties
Arguments
Gets/sets process invocation arguments
Declaration
public string Arguments { get; set; }
Property Value
| Type |
Description |
| System.String |
|
BufferedOutput
Returns buffered process output
Declaration
public string BufferedOutput { get; }
Property Value
| Type |
Description |
| System.String |
|
ExecutionTimeMs
Returns process execution time in milliseconds
Declaration
public int ExecutionTimeMs { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
ExitCode
Returns process last exit code
Declaration
public int ExitCode { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
ProcessCmd
Declaration
public string ProcessCmd { get; set; }
Property Value
| Type |
Description |
| System.String |
|
TimedOutAndKilled
Returns process last exit code
Declaration
public bool TimedOutAndKilled { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
Methods
Run(Int32)
Runs process blocking until it finishes, or timeout is exceeded. Pass zero for time-unconstrained execution
Declaration
public int Run(int timeoutMs = 0)
Parameters
| Type |
Name |
Description |
| System.Int32 |
timeoutMs |
|
Returns
| Type |
Description |
| System.Int32 |
|
Run(String, Int32)
Invokes a process specified by cmd parameters blocking until process finishes and returns stdout
Pass optional timeout parameter that will abort the process execution when exceeded, or zero for unlimited time.
Declaration
public static string Run(string cmd, int timeoutMs = 0)
Parameters
| Type |
Name |
Description |
| System.String |
cmd |
|
| System.Int32 |
timeoutMs |
|
Returns
| Type |
Description |
| System.String |
|
Run(String, String, out Boolean, Int32)
Invokes a process specified by cmd parameters blocking until process finishes and returns stdout.
Pass optional timeout parameter that will abort the process execution when exceeded, or zero for unlimited time.
Declaration
public static string Run(string cmd, string args, out bool timedOut, int timeoutMs = 0)
Parameters
| Type |
Name |
Description |
| System.String |
cmd |
|
| System.String |
args |
|
| System.Boolean |
timedOut |
|
| System.Int32 |
timeoutMs |
|
Returns
| Type |
Description |
| System.String |
|
Run(String, String, out Int32, out Boolean, Int32)
Invokes a process specified by cmd parameters blocking until process finishes and returns stdout.
Pass optional timeout parameter that will abort the process execution when exceeded, or zero for unlimited time.
Declaration
public static string Run(string cmd, string args, out int exitCode, out bool timedOut, int timeoutMs = 0)
Parameters
| Type |
Name |
Description |
| System.String |
cmd |
|
| System.String |
args |
|
| System.Int32 |
exitCode |
|
| System.Boolean |
timedOut |
|
| System.Int32 |
timeoutMs |
|
Returns
| Type |
Description |
| System.String |
|
Extension Methods