PeanutButter
|
Wraps process IO (stdout, stderr) into an easy-to-access disposable source. More...
Public Member Functions | |
int | WaitForExit () |
Wait for the process to exit and return the exit code. | |
int? | WaitForExit (int timeoutMilliseconds) |
Wait up to the timeout for the process to exit and return the exit code, if available. | |
void | Kill () |
Kill the underlying process. | |
bool | WaitForOutput (StandardIo io, Func< string, bool > matcher) |
Waits for some output to be emitted from the process. | |
bool | WaitForOutput (StandardIo io, Func< string, bool > matcher, int timeoutMilliseconds) |
Waits for some output to be emitted from the process. |
Properties | |
int | ProcessId [get] |
The process id. | |
bool | Started [get] |
True if the process started properly. | |
Exception | StartException [get] |
Set if the process didn't start properly, to the exception thrown. | |
IEnumerable< string > | StandardOutput [get] |
Read lines from stdout until the process exits. | |
IEnumerable< string > | StandardError [get] |
Read lines from stderr until the process exits. | |
IEnumerable< string > | StandardOutputAndErrorInterleaved [get] |
Read the lines from stderr and stdout (until the process exits), interleaved (mostly in order, though some minor out-of-order situations can occur between stderr and stdout if there is rapid output on both because of the async io handlers for dotnet Process objects. | |
IEnumerable< string > | StandardOutputSnapshot [get] |
Read the lines captured thus far from stdout - does not wait for the process to complete. | |
IEnumerable< string > | StandardErrorSnapshot [get] |
Read the lines captured thus far from stderr - does not wait for the process to complete. | |
IEnumerable< string > | StandardOutputAndErrorInterleavedSnapshot [get] |
Read the lines captured thus far from stderr and stdout, interleaved (mostly in order, though some minor out-of-order situations can occur between stderr and stdout if there is rapid output on both because of the async io handlers for dotnet Process objects. | |
int | MaxBufferLines [get, set] |
IO is buffered internally so you can start listening to it whenever you want, from the start - however, when the target process produces a lot of IO (eg mysqldump), it's reasonable to enforce a history limit to reduce memory usage. | |
StreamWriter | StandardInput [get] |
stdin for the process | |
Process | Process [get] |
Access to the underlying Process. | |
int | ExitCode [get] |
Provides access to the exit code of the process, waiting for it to complete if necessary. | |
bool | HasExited [get] |
Flag: true when the process has exited (or couldn't start up) | |
string | Filename [get] |
The program started by this ProcessIO. | |
string[] | Arguments [get] |
A copy of the commandline arguments to that program. | |
string | WorkingDirectory [get] |
The working directory in which the process was launched. | |
string | Commandline [get] |
Renders the commandline used to start this process. | |
OutputModes | OutputMode [get] |
Which output mode to use (buffered collections or events). Note that changes to this property will not be observed after the process has started. |
Events | |
EventHandler< string > | OnStdOut |
Raised when receiving data on stdout from the process. | |
EventHandler< string > | OnStdErr |
Raised when receiving data on stderr from the process. |
Wraps process IO (stdout, stderr) into an easy-to-access disposable source.
void PeanutButter.Utils.IProcessIO.Kill | ( | ) |
Kill the underlying process.
Implemented in PeanutButter.Utils.ProcessIO.
int PeanutButter.Utils.IProcessIO.WaitForExit | ( | ) |
Wait for the process to exit and return the exit code.
Implemented in PeanutButter.Utils.ProcessIO.
int? PeanutButter.Utils.IProcessIO.WaitForExit | ( | int | timeoutMilliseconds | ) |
Wait up to the timeout for the process to exit and return the exit code, if available.
timeoutMilliseconds |
Implemented in PeanutButter.Utils.ProcessIO.
bool PeanutButter.Utils.IProcessIO.WaitForOutput | ( | StandardIo | io, |
Func< string, bool > | matcher ) |
Waits for some output to be emitted from the process.
io | |
matcher |
Implemented in PeanutButter.Utils.ProcessIO.
bool PeanutButter.Utils.IProcessIO.WaitForOutput | ( | StandardIo | io, |
Func< string, bool > | matcher, | ||
int | timeoutMilliseconds ) |
Waits for some output to be emitted from the process.
io | |
matcher | |
timeoutMilliseconds |
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
A copy of the commandline arguments to that program.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
Renders the commandline used to start this process.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
Provides access to the exit code of the process, waiting for it to complete if necessary.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
The program started by this ProcessIO.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
Flag: true when the process has exited (or couldn't start up)
Implemented in PeanutButter.Utils.ProcessIO.
|
getset |
IO is buffered internally so you can start listening to it whenever you want, from the start - however, when the target process produces a lot of IO (eg mysqldump), it's reasonable to enforce a history limit to reduce memory usage.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
Which output mode to use (buffered collections or events). Note that changes to this property will not be observed after the process has started.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
Access to the underlying Process.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
The process id.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
Read lines from stderr until the process exits.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
Read the lines captured thus far from stderr - does not wait for the process to complete.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
stdin for the process
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
Read lines from stdout until the process exits.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
Read the lines from stderr and stdout (until the process exits), interleaved (mostly in order, though some minor out-of-order situations can occur between stderr and stdout if there is rapid output on both because of the async io handlers for dotnet Process objects.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
Read the lines captured thus far from stderr and stdout, interleaved (mostly in order, though some minor out-of-order situations can occur between stderr and stdout if there is rapid output on both because of the async io handlers for dotnet Process objects.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
Read the lines captured thus far from stdout - does not wait for the process to complete.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
True if the process started properly.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
Set if the process didn't start properly, to the exception thrown.
Implemented in PeanutButter.Utils.ProcessIO.
|
get |
The working directory in which the process was launched.
Implemented in PeanutButter.Utils.ProcessIO.