PeanutButter
Loading...
Searching...
No Matches
PeanutButter.Utils.IProcessIO Interface Reference

Wraps process IO (stdout, stderr) into an easy-to-access disposable source. More...

Inheritance diagram for PeanutButter.Utils.IProcessIO:
PeanutButter.Utils.IUnstartedProcessIO PeanutButter.Utils.ProcessIO PeanutButter.Utils.ProcessIO.UnstartedProcessIO PeanutButter.Utils.ProcessIO.UnstartedProcessIO

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.

Detailed Description

Wraps process IO (stdout, stderr) into an easy-to-access disposable source.

Member Function Documentation

◆ Kill()

void PeanutButter.Utils.IProcessIO.Kill ( )

Kill the underlying process.

Implemented in PeanutButter.Utils.ProcessIO.

◆ WaitForExit() [1/2]

int PeanutButter.Utils.IProcessIO.WaitForExit ( )

Wait for the process to exit and return the exit code.

Returns

Implemented in PeanutButter.Utils.ProcessIO.

◆ WaitForExit() [2/2]

int? PeanutButter.Utils.IProcessIO.WaitForExit ( int timeoutMilliseconds)

Wait up to the timeout for the process to exit and return the exit code, if available.

Parameters
timeoutMilliseconds
Returns

Implemented in PeanutButter.Utils.ProcessIO.

◆ WaitForOutput() [1/2]

bool PeanutButter.Utils.IProcessIO.WaitForOutput ( StandardIo io,
Func< string, bool > matcher )

Waits for some output to be emitted from the process.

Parameters
io
matcher

Implemented in PeanutButter.Utils.ProcessIO.

◆ WaitForOutput() [2/2]

bool PeanutButter.Utils.IProcessIO.WaitForOutput ( StandardIo io,
Func< string, bool > matcher,
int timeoutMilliseconds )

Waits for some output to be emitted from the process.

Parameters
io
matcher
timeoutMilliseconds

Implemented in PeanutButter.Utils.ProcessIO.

Property Documentation

◆ Arguments

string [] PeanutButter.Utils.IProcessIO.Arguments
get

A copy of the commandline arguments to that program.

Implemented in PeanutButter.Utils.ProcessIO.

◆ Commandline

string PeanutButter.Utils.IProcessIO.Commandline
get

Renders the commandline used to start this process.

Implemented in PeanutButter.Utils.ProcessIO.

◆ ExitCode

int PeanutButter.Utils.IProcessIO.ExitCode
get

Provides access to the exit code of the process, waiting for it to complete if necessary.

Implemented in PeanutButter.Utils.ProcessIO.

◆ Filename

string PeanutButter.Utils.IProcessIO.Filename
get

The program started by this ProcessIO.

Implemented in PeanutButter.Utils.ProcessIO.

◆ HasExited

bool PeanutButter.Utils.IProcessIO.HasExited
get

Flag: true when the process has exited (or couldn't start up)

Implemented in PeanutButter.Utils.ProcessIO.

◆ MaxBufferLines

int PeanutButter.Utils.IProcessIO.MaxBufferLines
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.

◆ OutputMode

OutputModes PeanutButter.Utils.IProcessIO.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.

Implemented in PeanutButter.Utils.ProcessIO.

◆ Process

Process PeanutButter.Utils.IProcessIO.Process
get

Access to the underlying Process.

Implemented in PeanutButter.Utils.ProcessIO.

◆ ProcessId

int PeanutButter.Utils.IProcessIO.ProcessId
get

The process id.

Implemented in PeanutButter.Utils.ProcessIO.

◆ StandardError

IEnumerable<string> PeanutButter.Utils.IProcessIO.StandardError
get

Read lines from stderr until the process exits.

Implemented in PeanutButter.Utils.ProcessIO.

◆ StandardErrorSnapshot

IEnumerable<string> PeanutButter.Utils.IProcessIO.StandardErrorSnapshot
get

Read the lines captured thus far from stderr - does not wait for the process to complete.

Implemented in PeanutButter.Utils.ProcessIO.

◆ StandardInput

StreamWriter PeanutButter.Utils.IProcessIO.StandardInput
get

stdin for the process

Implemented in PeanutButter.Utils.ProcessIO.

◆ StandardOutput

IEnumerable<string> PeanutButter.Utils.IProcessIO.StandardOutput
get

Read lines from stdout until the process exits.

Implemented in PeanutButter.Utils.ProcessIO.

◆ StandardOutputAndErrorInterleaved

IEnumerable<string> PeanutButter.Utils.IProcessIO.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.

Implemented in PeanutButter.Utils.ProcessIO.

◆ StandardOutputAndErrorInterleavedSnapshot

IEnumerable<string> PeanutButter.Utils.IProcessIO.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.

  • does not wait for the process to complete

Implemented in PeanutButter.Utils.ProcessIO.

◆ StandardOutputSnapshot

IEnumerable<string> PeanutButter.Utils.IProcessIO.StandardOutputSnapshot
get

Read the lines captured thus far from stdout - does not wait for the process to complete.

Implemented in PeanutButter.Utils.ProcessIO.

◆ Started

bool PeanutButter.Utils.IProcessIO.Started
get

True if the process started properly.

Implemented in PeanutButter.Utils.ProcessIO.

◆ StartException

Exception PeanutButter.Utils.IProcessIO.StartException
get

Set if the process didn't start properly, to the exception thrown.

Implemented in PeanutButter.Utils.ProcessIO.

◆ WorkingDirectory

string PeanutButter.Utils.IProcessIO.WorkingDirectory
get

The working directory in which the process was launched.

Implemented in PeanutButter.Utils.ProcessIO.


The documentation for this interface was generated from the following file:
  • source/Utils/PeanutButter.Utils/ProcessIO.cs