23 lines
515 B
C#
23 lines
515 B
C#
using System.Diagnostics;
|
|
|
|
namespace MxGateway.Server.Workers;
|
|
|
|
public sealed class SystemWorkerProcessFactory : IWorkerProcessFactory
|
|
{
|
|
public IWorkerProcess Start(ProcessStartInfo startInfo)
|
|
{
|
|
Process process = new()
|
|
{
|
|
StartInfo = startInfo,
|
|
};
|
|
|
|
if (!process.Start())
|
|
{
|
|
process.Dispose();
|
|
throw new InvalidOperationException("Worker process failed to start.");
|
|
}
|
|
|
|
return new SystemWorkerProcess(process);
|
|
}
|
|
}
|