28 lines
640 B
C#
28 lines
640 B
C#
using System.Diagnostics;
|
|
|
|
namespace MxGateway.Server.Workers;
|
|
|
|
internal sealed class SystemWorkerProcess(Process process) : IWorkerProcess
|
|
{
|
|
public int Id => process.Id;
|
|
|
|
public bool HasExited => process.HasExited;
|
|
|
|
public int? ExitCode => process.HasExited ? process.ExitCode : null;
|
|
|
|
public async ValueTask WaitForExitAsync(CancellationToken cancellationToken)
|
|
{
|
|
await process.WaitForExitAsync(cancellationToken).ConfigureAwait(false);
|
|
}
|
|
|
|
public void Kill(bool entireProcessTree)
|
|
{
|
|
process.Kill(entireProcessTree);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
process.Dispose();
|
|
}
|
|
}
|