Files
StarterNG/StarterNG/Application/Abstractions/IProcessLauncher.cs
maj00r 59798e41fa Report a simulator that crashes or closes right after the start
The exit code, read with its signal or NTSTATUS, and the last lines of the
error stream - or of log.txt when it stayed silent. The stream is captured
only while the starter stays to read it.
2026-10-04 13:38:29 +02:00

34 lines
1.1 KiB
C#

using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace StarterNG.Application.Abstractions;
public interface IProcessHandle
{
bool HasExited { get; }
/// <summary>Once it has ended; null while running, or for a process the starter did not start.</summary>
int? ExitCode { get; }
/// <summary>The last lines of the error stream, when it was captured.</summary>
IReadOnlyList<string> ErrorTail { get; }
Task WaitForExitAsync(CancellationToken cancellationToken = default);
}
public interface IProcessLauncher
{
/// <summary>
/// Starts a process. With captureErrors its error stream is kept for the
/// handle - only for a process the starter outlives: a write to a pipe nobody
/// reads any more can kill the writer.
/// </summary>
IProcessHandle? Start(string executablePath, IReadOnlyList<string> arguments, string? workingDirectory,
bool captureErrors, out string? error);
bool OpenInShell(string pathOrUrl);
IProcessHandle? FindRunning(string processName);
}