private bool NotifyToExit(Process proc) { try { proc.StandardInput.Write("exit\r\n"); proc.StandardInput.Flush(); Conf.Info("Notified Worker to exit"); } catch (Exception ex) { Conf.Error($"Failed to notify Worker to exit:\r\n{ex}"); return(false); } if (!proc.WaitForExit(Conf.WaitSecondsForWorkerToExit * 1000)) { Conf.Info("Worker refused to exit"); return(false); } Conf.Info($"Worker exited with code {proc.ExitCode}"); return(true); }