Exemplo n.º 1
0
 private void OnProcessExited(object sender, EventArgs e)
 {
     if (_disposing)
     {
         // No action needed
         return;
     }
     string exceptionMessage = string.Join(",", _processStdErrDataQueue.Where(s => !string.IsNullOrEmpty(s)));
     try
     {
         if (_process.ExitCode == WorkerConstants.SuccessExitCode)
         {
             _process.WaitForExit();
             _process.Close();
         }
         else if (_process.ExitCode == WorkerConstants.IntentionalRestartExitCode)
         {
             HandleWorkerProcessRestart();
         }
         else
         {
             var processExitEx = new WorkerProcessExitException($"{_process.StartInfo.FileName} exited with code {_process.ExitCode}\n {exceptionMessage}");
             processExitEx.ExitCode = _process.ExitCode;
             processExitEx.Pid = _process.Id;
             HandleWorkerProcessExitError(processExitEx);
         }
     }
     catch (Exception exc)
     {
         _workerProcessLogger?.LogDebug(exc, "Exception on worker process exit.");
         // ignore process is already disposed
     }
 }
Exemplo n.º 2
0
 internal abstract void HandleWorkerProcessExitError(WorkerProcessExitException langExc);