ProcessRunner.Run Method

Definition

Overloads

Run(Process, StringBuilder, StringBuilder, Exception, Int32)

Starts the given process and accumulates the received output and error data in the given StringBuilders. Returns true if the process completed within the specified time without throwing an exception, and false otherwise. Any thrown exception is returned as out parameter.

Run(String, String, StringBuilder, StringBuilder, Int32, Exception, IDictionary<String,String>, Int32, Int32)

Starts and runs a process invoking the given command with the given arguments. If a dictionary of environment variables and their desired values is specified, sets these environment variables prior to execution and resets them afterwards. Accumulates the received output and error data in the respective StringBuilder and returns them as out parameters. Returns true if the process completed within the specified time without throwing an exception, and false otherwise. Returns the exit code of the process as well as any thrown exception as out parameter.

Run(Process, StringBuilder, StringBuilder, Exception, Int32)

Starts the given process and accumulates the received output and error data in the given StringBuilders. Returns true if the process completed within the specified time without throwing an exception, and false otherwise. Any thrown exception is returned as out parameter.

public static bool Run (System.Diagnostics.Process process, System.Text.StringBuilder output, System.Text.StringBuilder error, out Exception? ex, int timeout);
static member Run : System.Diagnostics.Process * System.Text.StringBuilder * System.Text.StringBuilder * Exception * int -> bool
Public Shared Function Run (process As Process, output As StringBuilder, error As StringBuilder, ByRef ex As Exception, timeout As Integer) As Boolean

Parameters

process
Process
output
StringBuilder
timeout
Int32

Returns

Boolean

Applies to

Run(String, String, StringBuilder, StringBuilder, Int32, Exception, IDictionary<String,String>, Int32, Int32)

Starts and runs a process invoking the given command with the given arguments. If a dictionary of environment variables and their desired values is specified, sets these environment variables prior to execution and resets them afterwards. Accumulates the received output and error data in the respective StringBuilder and returns them as out parameters. Returns true if the process completed within the specified time without throwing an exception, and false otherwise. Returns the exit code of the process as well as any thrown exception as out parameter.

public static bool Run (string command, string args, out System.Text.StringBuilder outstream, out System.Text.StringBuilder errstream, out int exitCode, out Exception? ex, System.Collections.Generic.IDictionary<string,string>? envVariables = default, int timeout = 10000, int exitCodeOnTimeOut = 1);
static member Run : string * string * StringBuilder * StringBuilder * int * Exception * System.Collections.Generic.IDictionary<string, string> * int * int -> bool
Public Shared Function Run (command As String, args As String, ByRef outstream As StringBuilder, ByRef errstream As StringBuilder, ByRef exitCode As Integer, ByRef ex As Exception, Optional envVariables As IDictionary(Of String, String) = Nothing, Optional timeout As Integer = 10000, Optional exitCodeOnTimeOut As Integer = 1) As Boolean

Parameters

command
String
args
String
outstream
StringBuilder
errstream
StringBuilder
exitCode
Int32
envVariables
IDictionary<String,String>
timeout
Int32
exitCodeOnTimeOut
Int32

Returns

Boolean

Applies to