NanoByte.Common  2.9.0
NanoByte.Common.Streams.ChildProcess Class Reference

Runs an external processes with redirected stdin, stdout and stderr steams. More...

Public Member Functions

virtual string Execute (params string[] arguments)
 Runs the external process, processes its output and waits until it has terminated. More...
 

Protected Member Functions

virtual ProcessStartInfo GetStartInfo (params string[] arguments)
 Creates the ProcessStartInfo used by Execute to launch the external application and redirect its input/output. More...
 
virtual void InitStdin (StreamWriter writer)
 A hook method for writing to the application's stdin right after startup. More...
 
virtual ? string HandleStderr (string line)
 A hook method for handling stderr messages from the CLI application. More...
 

Properties

abstract string AppBinary [get]
 The name of the application's binary (without a file extension). More...
 

Detailed Description

Runs an external processes with redirected stdin, stdout and stderr steams.

Member Function Documentation

◆ Execute()

virtual string NanoByte.Common.Streams.ChildProcess.Execute ( params string[]  arguments)
inlinevirtual

Runs the external process, processes its output and waits until it has terminated.

Parameters
argumentsCommand-line arguments to launch the application with.
Returns
The application's complete stdout output.
Exceptions
IOExceptionThe external application could not be launched.

◆ GetStartInfo()

virtual ProcessStartInfo NanoByte.Common.Streams.ChildProcess.GetStartInfo ( params string[]  arguments)
inlineprotectedvirtual

Creates the ProcessStartInfo used by Execute to launch the external application and redirect its input/output.

Parameters
argumentsThe arguments to pass to the process at startup.

◆ HandleStderr()

virtual ? string NanoByte.Common.Streams.ChildProcess.HandleStderr ( string  line)
inlineprotectedvirtual

A hook method for handling stderr messages from the CLI application.

Parameters
lineThe line written to stderr.
Returns
The response to write to stdin; null for none.

◆ InitStdin()

virtual void NanoByte.Common.Streams.ChildProcess.InitStdin ( StreamWriter  writer)
inlineprotectedvirtual

A hook method for writing to the application's stdin right after startup.

Parameters
writerThe stream writer providing access to stdin.

Property Documentation

◆ AppBinary

abstract string NanoByte.Common.Streams.ChildProcess.AppBinary
getprotected

The name of the application's binary (without a file extension).


The documentation for this class was generated from the following file: