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: Azos.dll
public sealed class ProcessRunner
Constructors
Declaration
Properties
Gets/sets process invocation arguments
Declaration
public string Arguments { get; set; }
Property Value
Type |
Description |
System.String |
|
Returns buffered process output
Declaration
public string BufferedOutput { get; }
Property Value
Type |
Description |
System.String |
|
Returns process execution time in milliseconds
Declaration
public int ExecutionTimeMs { get; }
Property Value
Type |
Description |
System.Int32 |
|
Returns process last exit code
Declaration
public int ExitCode { get; }
Property Value
Type |
Description |
System.Int32 |
|
Declaration
public string ProcessCmd { get; set; }
Property Value
Type |
Description |
System.String |
|
Returns process last exit code
Declaration
public bool TimedOutAndKilled { get; }
Property Value
Type |
Description |
System.Boolean |
|
Methods
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 |
|
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 |
|
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 |
|
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