Class ProcessRunnerWithNotification
Provides functionality to run processes with notifications for their lifecycle events.
public static class ProcessRunnerWithNotification
- Inheritance
-
ProcessRunnerWithNotification
Fields
- DefaultInputOutputEncoding
Specifies the default encoding used for standard input, output, and error streams when running a process.
- ErrorOutputPrefix
Prefix for error output messages.
- OutputPrefix
Prefix for standard output messages.
- ProcessExitedSeparator
Separator message added to log when a process exits.
- ProcessExitedWithResult
Message template for logging process exit results.
Properties
- HasRunningProcess
Gets a value indicating whether there is a running process that has not exited.
- RunningProcess
Gets or sets the currently running process.
Methods
- Bind(IProcessRunnerNotification)
Binds a subscriber to receive process notifications.
- BindProcessEvents(Process)
Binds event handlers to the specified Process to handle its output, error, exit, and disposal events. Notifies all subscribers about process lifecycle events and logs output and error data.
- KillRunningProcess()
Kills the currently running process, if any.
- RunProcess(ProcessStartInfo)
Runs a process using the specified start information.
- RunProcessAndWait(ProcessStartInfo, bool)
Runs a process using the specified start information and optionally waits for it to exit.
- Unbind(IProcessRunnerNotification)
Unbinds a subscriber from receiving process notifications.
Events
- RunningProcessDisposed
Occurs when the currently running process is disposed.
- RunningProcessExited
Occurs when the currently running process exits.