Files
dnsmasq-webui/src/DnsmasqWebUI/Infrastructure/Services/Common/Process/Abstractions/IProcessHandle.cs
T
alex 8ed66cdf48 Process runner, save/restore flow, status script, listen-address IPv6
- Process: Add IProcessHandle, ProcessOutputLine, StartAsync; RunAsync via StartAsync+WaitForExitAsync. Wait for stdout/stderr stream close before reading to fix empty restart output. ProcessTimeouts; ReloadService/StatusController/LogsService use config timeouts.
- Effective config: Rename reload→restart in save/restore result types and UI. Save modal: show restart output, danger alert, Stop editing/Continue editing (yellow), footer one-line; fallback exit code when no output; ensure pre visibility (CSS). Restore failed: combined output helper.
- Status script: When dnsmasq dead, run dnsmasq --test and show config error in status block (Docker harness; DNSMASQ_CONF).
- listen-address: Allow IPv6 (ValidateDraftValue accepts InterNetworkV6).
- Docker test: RestartCommand uses DnsmasqOptions timeout; DnsmasqOptions RestartTimeoutSeconds.
2026-03-01 22:23:17 +10:00

21 lines
1.1 KiB
C#

using DnsmasqWebUI.Models.Contracts;
namespace DnsmasqWebUI.Infrastructure.Services.Common.Process.Abstractions;
/// <summary>
/// Handle to a started process. Call <see cref="ReadOutputAsync"/> for streaming output,
/// and/or <see cref="WaitForExitAsync"/> to wait for completion and get final result.
/// Disposing the handle kills the process if still running.
/// </summary>
public interface IProcessHandle : IAsyncDisposable
{
/// <summary>Stream output lines as they are produced. Completes when the process exits and all output is read.</summary>
IAsyncEnumerable<ProcessOutputLine> ReadOutputAsync(CancellationToken ct = default);
/// <summary>Wait for the process to exit (or timeout). Returns final stdout/stderr and exit code. If timeout is set and exceeded, kills the process and returns with <see cref="ProcessRunResult.TimedOut"/> true.</summary>
Task<ProcessRunResult> WaitForExitAsync(TimeSpan? timeout = null, CancellationToken ct = default);
/// <summary>Kill the process.</summary>
Task KillAsync(CancellationToken ct = default);
}