public async Task StartAsync()

{
    if (_client?.State == PipeState.Connected)
        return;
This commit is contained in:
Matthias Heil
2026-11-12 07:28:23 +01:00
parent b7ddb46ded
commit 98bdb3cf0d
+5 -2
View File
@@ -5,7 +5,7 @@ using System.Diagnostics;
namespace PipeClient;
/// <summary>
/// Owns the server process and the pipe client connected to it.
/// Manages a pipe client and any server process it starts.
/// </summary>
internal sealed class ServerConnection(string pipeName, Action<string> log) : IDisposable
{
@@ -19,6 +19,9 @@ internal sealed class ServerConnection(string pipeName, Action<string> log) : ID
public async Task StartAsync()
{
if (_client?.State == PipeState.Connected)
return;
var process = StartServerProcess(PipeName);
process.EnableRaisingEvents = true;
process.Exited += (_, _) =>
@@ -34,7 +37,7 @@ internal sealed class ServerConnection(string pipeName, Action<string> log) : ID
}
/// <summary>
/// Kills the (unresponsive) server process and starts a new one.
/// Kills the owned server process, if any, and starts a new one.
/// </summary>
public async Task KillAndRestartAsync()
{