Exemplo n.º 1
0
        public void Dispose()
        {
            RserveToken?.Cancel();
            RTermToken?.Cancel();

            if (RtermProcess != null)
            {
                Connection?.Dispose();
                RtermProcess?.Kill();
                RtermProcess?.Dispose();
            }
            else
            {
                Connection?.Dispose();
            }
        }
Exemplo n.º 2
0
        private void FindRTermProcess()
        {
            while (RTermToken != null && !RTermToken.IsCancellationRequested)
            {
                if (RtermProcess == null)
                {
                    RtermProcess = StartPServeWithRTerm();
                }
                else if (RtermProcess.HasExited)
                {
                    logger.Debug($"rProcess terminated at {RtermProcess.ExitTime}, exitcode: {RtermProcess.ExitCode}");
                    // Try to start the process again, but wait a little bit before trying since it could be a normal shutdown
                    Thread.Sleep(10000);
                    RtermProcess?.Dispose();
                    RtermProcess = null;
                }

                Thread.Sleep(2500);
            }
        }