public async Task EnsureStarted_KillProcess_EnsureStarted() { var session = new RSession(0, _testMethod.FileSystemSafeName, _brokerClient, new AsyncReaderWriterLock().CreateExclusiveReaderLock(), () => { }); session.HostStarted.Should().NotBeCompleted(); session.IsHostRunning.Should().BeFalse(); await session.EnsureHostStartedAsync(new RHostStartupInfo(), null, 50000); session.HostStarted.Should().BeRanToCompletion(); session.IsHostRunning.Should().BeTrue(); var sessionDisconnectedTask = EventTaskSources.IRSession.Disconnected.Create(session); var processId = await GetRSessionProcessId(session); Process.GetProcessById(processId).Kill(); await sessionDisconnectedTask; session.IsHostRunning.Should().BeFalse(); await session.EnsureHostStartedAsync(new RHostStartupInfo(), null, 50000); session.HostStarted.Should().BeRanToCompletion(); session.IsHostRunning.Should().BeTrue(); }
public async Task <IRSession> StartSessionAsync(CancellationToken ct) { if (RSession == null) { var workflow = _services.GetService <IRInteractiveWorkflowProvider>().GetOrCreate(); RSession = workflow.RSessions.GetOrCreate(_sessionId); } else { await _sessionStart; } if (!RSession.IsHostRunning) { var settings = _services.GetService <IRSettings>(); await RSession.EnsureHostStartedAsync(new RHostStartupInfo(isInteractive : true), SessionCallback, 3000, ct); await RSession.SetVsCranSelectionAsync(CranMirrorList.UrlFromName(settings.CranMirror), ct); await RSession.SetCodePageAsync(settings.RCodePage, ct); await RSession.SetVsGraphicsDeviceAsync(); } return(RSession); }
public async Task <IRSession> StartSessionAsync(CancellationToken ct) { if (RSession == null) { var workflow = _services.GetService <IRInteractiveWorkflowProvider>().GetOrCreate(); RSession = workflow.RSessions.GetOrCreate(_sessionId); } else { await _sessionStart; } if (!RSession.IsHostRunning) { var settings = _services.GetService <IRSettings>(); await RSession.EnsureHostStartedAsync( new RHostStartupInfo(settings.CranMirror, codePage : settings.RCodePage), SessionCallback, 3000, ct); } return(RSession); }