using System.Diagnostics;
Console.WriteLine("Выбрать сценарий:\n1 — дождатся\n2 — прервать ");
string n = Console.ReadLine();
Process process = Process.Start(new ProcessStartInfo
{
FileName = "C:\\Users\\CCU\\Desktop\\ProcessWorker\\bin\\Debug\\net10.0\\ProcessWorker",
UseShellExecute = true
});
if (process is null)
{
Console.WriteLine("Failed");
}
else
{
Console.WriteLine($"{process.Id}");
}
if (n == "2") { process.Kill(); }
await process.WaitForExitAsync();
Console.WriteLine(process.ExitCode);