Class ExecuteResponse
Holds the process exit code and captured standard output from a process launched by any of the ExecuteCapture(string, object[], TimeSpan?, Process, string, bool, Dictionary<string, string>, Action<string>, Action<string>, TextReader, Encoding, Action<Process>) related methods.
Namespace: Neon.Common
Assembly: Neon.Common.dll
Syntax
public class ExecuteResponse
Constructors
ExecuteResponse(int, string, string)
Constuctor.
Declaration
public ExecuteResponse(int exitCode, string outputText = null, string errorText = null)
Parameters
Type | Name | Description |
---|---|---|
int | exitCode | The exit code. |
string | outputText | Optionally specifies the output text. |
string | errorText | Optionally specifies the error text. |
Properties
AllText
Returns the captured standard output and error stream text from the process.
Declaration
public string AllText { get; }
Property Value
Type | Description |
---|---|
string |
ErrorText
Returns the captured standard error stream text from the process.
Declaration
public string ErrorText { get; }
Property Value
Type | Description |
---|---|
string |
ExitCode
Returns the process exit code.
Declaration
public int ExitCode { get; }
Property Value
Type | Description |
---|---|
int |
OutputText
Returns the captured standard output stream text from the process.
Declaration
public string OutputText { get; }
Property Value
Type | Description |
---|---|
string |
Methods
EnsureSuccess(bool)
Ensure that the command returned a zero exit code.
Declaration
public ExecuteResponse EnsureSuccess(bool errorOnly = false)
Parameters
Type | Name | Description |
---|---|---|
bool | errorOnly | Optionally return only the text written to STDERR in the exception for errors when something besides whitespace was written to STDERR, otherwise include all text written to the output streams. |
Returns
Type | Description |
---|---|
ExecuteResponse | The response for fluent-style chaining. |
Exceptions
Type | Condition |
---|---|
ExecuteException | Thrown if the exit code isn't zero. |