Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(718)

Unified Diff: pkg/analysis_server/lib/src/plugin/plugin_manager.dart

Issue 2849253002: Fix bugs found while working on tests (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/plugin/plugin_manager.dart
diff --git a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
index 50fb85cc50fa3fee19fd1114505906abd1ba20e9..a32daa41819f9db051715dfc0f472cbc74d3c0d3 100644
--- a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
+++ b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
@@ -111,14 +111,17 @@ class PluginInfo {
/**
* Start a new isolate that is running the plugin. Return the state object
- * used to interact with the plugin.
+ * used to interact with the plugin, or `null` if the plugin could not be run.
*/
Future<PluginSession> start(String byteStorePath) async {
if (currentSession != null) {
throw new StateError('Cannot start a plugin that is already running.');
}
currentSession = new PluginSession(this);
- await currentSession.start(byteStorePath);
+ bool isRunning = await currentSession.start(byteStorePath);
+ if (!isRunning) {
+ currentSession = null;
+ }
return currentSession;
}
@@ -226,7 +229,7 @@ class PluginManager {
_pluginMap[path] = plugin;
if (pluginPaths[0] != null) {
PluginSession session = await plugin.start(byteStorePath);
- session.onDone.then((_) {
+ session?.onDone?.then((_) {
_pluginMap.remove(path);
});
}
@@ -644,6 +647,11 @@ class PluginSession {
info.instrumentationService);
await channel.listen(handleResponse, handleNotification,
onDone: handleOnDone, onError: handleOnError);
+ if (channel == null) {
+ // If there is an error when starting the isolate, the channel will invoke
+ // handleOnDone, which will cause `channel` to be set to `null`.
+ return false;
+ }
Response response = await sendRequest(
new PluginVersionCheckParams(byteStorePath ?? '', '1.0.0-alpha.0'));
PluginVersionCheckResult result =
« no previous file with comments | « no previous file | pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698