internal static bool HandleMainprocessStatus(MainProcessWatcher state)
        {
            var isMainAlive = IsMainProcessAlive(state);

            if (!isMainAlive)
            {
                KillChildProcesses();
            }
            return(!isMainAlive);
        }
 private static bool IsMainProcessAlive(MainProcessWatcher watcher)
 {
     try
     {
         Process.GetProcessById(watcher.ProcessId);
         Console.WriteLine("MainProcess is alive");
         return(true);
     }
     catch (ArgumentException)
     {
         Console.WriteLine("MainProcess exited");
         return(false);
     }
 }