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

Provides the contract for an unstarted ProcessIO, as would be obtained from ProcessIO.In(workingDir) More...

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

Public Member Functions

IProcessIO Start (string filename, params string[] arguments)
 Starts the process in the previously provided working directory.
IUnstartedProcessIO WithEnvironmentVariable (string name, string value)
 Adds another environment variable to the process startup environment.
IUnstartedProcessIO In (string workingDirectory)
 Set the working directory for the process; use if you started the fluent chain with WithEnvironmentVariable
IUnstartedProcessIO WithEnvironment (IDictionary< string, string > env)
 Establish a set of environment variables for the process.
IUnstartedProcessIO WithStdOutReceiver (Action< string > receiver)
 Starts the process with an action to receive stdout data as it streams, instead of buffering to a collection.
IUnstartedProcessIO WithStdErrReceiver (Action< string > receiver)
 Starts the process with an action to receive stderr data as it streams, instead of buffering to a collection.
IUnstartedProcessIO WithPassthroughIo ()
 Allows stdout and stderr to be passed through to the calling shell, effectively shorthand for .WithStdOutReceiver(Console.WriteLine) .WithStdErrReceiver(Console.Error.WriteLine)
Public Member Functions inherited from PeanutButter.Utils.IProcessIO
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.

Additional Inherited Members

Properties inherited from PeanutButter.Utils.IProcessIO
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 inherited from PeanutButter.Utils.IProcessIO
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

Provides the contract for an unstarted ProcessIO, as would be obtained from ProcessIO.In(workingDir)

Member Function Documentation

◆ In()

IUnstartedProcessIO PeanutButter.Utils.IUnstartedProcessIO.In ( string workingDirectory)

Set the working directory for the process; use if you started the fluent chain with WithEnvironmentVariable

Parameters
workingDirectory
Returns

Implemented in PeanutButter.Utils.ProcessIO.UnstartedProcessIO.

◆ Start()

IProcessIO PeanutButter.Utils.IUnstartedProcessIO.Start ( string filename,
params string[] arguments )

Starts the process in the previously provided working directory.

Parameters
filename
arguments
Returns

Implemented in PeanutButter.Utils.ProcessIO.UnstartedProcessIO.

◆ WithEnvironment()

IUnstartedProcessIO PeanutButter.Utils.IUnstartedProcessIO.WithEnvironment ( IDictionary< string, string > env)

Establish a set of environment variables for the process.

Parameters
env
Returns

Implemented in PeanutButter.Utils.ProcessIO.UnstartedProcessIO.

◆ WithEnvironmentVariable()

IUnstartedProcessIO PeanutButter.Utils.IUnstartedProcessIO.WithEnvironmentVariable ( string name,
string value )

Adds another environment variable to the process startup environment.

Parameters
name
value
Returns

Implemented in PeanutButter.Utils.ProcessIO.UnstartedProcessIO.

◆ WithPassthroughIo()

IUnstartedProcessIO PeanutButter.Utils.IUnstartedProcessIO.WithPassthroughIo ( )

Allows stdout and stderr to be passed through to the calling shell, effectively shorthand for .WithStdOutReceiver(Console.WriteLine) .WithStdErrReceiver(Console.Error.WriteLine)

Returns

Implemented in PeanutButter.Utils.ProcessIO.UnstartedProcessIO.

◆ WithStdErrReceiver()

IUnstartedProcessIO PeanutButter.Utils.IUnstartedProcessIO.WithStdErrReceiver ( Action< string > receiver)

Starts the process with an action to receive stderr data as it streams, instead of buffering to a collection.

Parameters
receiver
Returns

Implemented in PeanutButter.Utils.ProcessIO.UnstartedProcessIO.

◆ WithStdOutReceiver()

IUnstartedProcessIO PeanutButter.Utils.IUnstartedProcessIO.WithStdOutReceiver ( Action< string > receiver)

Starts the process with an action to receive stdout data as it streams, instead of buffering to a collection.

Parameters
receiver
Returns

Implemented in PeanutButter.Utils.ProcessIO.UnstartedProcessIO.


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