Table of Contents

Interface IProcessLauncher

Namespace
NanoByte.Common.Native
Assembly
NanoByte.Common.dll

Runs an external process.

public interface IProcessLauncher
Extension Methods

Methods

GetStartInfo(params string[])

Creates the ProcessStartInfo used to launch the process.

ProcessStartInfo GetStartInfo(params string[] arguments)

Parameters

arguments string[]

The arguments to pass to the process at startup.

Returns

ProcessStartInfo

Run(params string[])

Runs the process and waits for it to exit.

void Run(params string[] arguments)

Parameters

arguments string[]

Command-line arguments to launch the process with.

Exceptions

IOException

There was a problem launching the executable.

FileNotFoundException

The executable file could not be found.

NotAdminException

The target process requires elevation.

ExitCodeException

The process exited with a non-zero ExitCode.

RunAndCapture(Action<StreamWriter>?, params string[])

Runs the process, captures its stdout and stderr output and waits for it to exit.

string RunAndCapture(Action<StreamWriter>? onStartup, params string[] arguments)

Parameters

onStartup Action<StreamWriter>

A callback for writing to the process' stdin right after startup.

arguments string[]

Command-line arguments to launch the process with.

Returns

string

The process' complete stdout output.

Exceptions

IOException

There was a problem launching the executable.

FileNotFoundException

The executable file could not be found.

NotAdminException

The target process requires elevation.

ExitCodeException

The process exited with a non-zero ExitCode.

Start(params string[])

Starts the process and runs it in parallel with this one.

Process Start(params string[] arguments)

Parameters

arguments string[]

Command-line arguments to launch the process with.

Returns

Process

The newly launched process.

Exceptions

IOException

There was a problem launching the executable.

FileNotFoundException

The executable file could not be found.

NotAdminException

The target process requires elevation.