Exemplo n.º 1
0
        public virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_output != null)
                {
                    _output.Dispose();
                    _output = null;
                }

                if (Errors != null)
                {
                    Errors.Dispose();
                    Errors = null;
                }

                if (_startedEvent != null)
                {
                    _startedEvent.Set();
                    _startedEvent.Dispose();
                    _startedEvent = null;
                }

                if (_completedEvent != null)
                {
                    _completedEvent.Set();
                    _completedEvent.Dispose();
                    _completedEvent = null;
                }
            }
        }
Exemplo n.º 2
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_process != null)
         {
             if (!_process.HasExited)
             {
                 // this object is being disposed, yet the process isn't finished.
                 Console.WriteLine("Killing AsyncProcess");
                 _process.Kill();
             }
             ((IDisposable)_process).Dispose();
         }
         _process = null;
         if (_stdOut != null)
         {
             ((IDisposable)_stdOut).Dispose();
         }
         _stdOut = null;
         if (_stdError != null)
         {
             ((IDisposable)_stdError).Dispose();
         }
         _stdError = null;
         if (_stdOutStarted != null)
         {
             _stdOutStarted.Dispose();
         }
         _stdOutStarted = null;
         if (_stdErrStarted != null)
         {
             _stdErrStarted.Dispose();
         }
         _stdErrStarted = null;
     }
 }