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

Unified Diff: pkg/analysis_server/lib/src/analysis_manager.dart

Issue 1900503002: More steps toward making server strong mode clean (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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/analysis_server/lib/src/search/element_references.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/analysis_manager.dart
diff --git a/pkg/analysis_server/lib/src/analysis_manager.dart b/pkg/analysis_server/lib/src/analysis_manager.dart
index 2e9924cb37ff96504583f969a313b862b0ab274c..126dbb858943ffb3fb5c99d39d927335db50489b 100644
--- a/pkg/analysis_server/lib/src/analysis_manager.dart
+++ b/pkg/analysis_server/lib/src/analysis_manager.dart
@@ -36,11 +36,12 @@ class AnalysisManager {
* Otherwise there was no attached process or the signal could not be sent,
* usually meaning that the process is already dead.
*/
- Future<bool> stop() {
+ Future<bool> stop() async {
if (process == null) {
- return channel.close().then((_) => false);
+ await channel.close();
+ return false;
}
- return channel
+ int result = await channel
.sendRequest(new ServerShutdownParams().toRequest('0'))
.timeout(new Duration(seconds: 2), onTimeout: () {
print('Expected shutdown response');
@@ -49,12 +50,11 @@ class AnalysisManager {
}).timeout(new Duration(seconds: 2), onTimeout: () {
print('Expected server to shutdown');
process.kill();
- }).then((int result) {
- if (result != null && result != 0) {
- exitCode = result;
- }
- return true;
});
+ if (result != null && result != 0) {
+ exitCode = result;
+ }
+ return true;
}
/**
@@ -102,7 +102,7 @@ class AnalysisManager {
/**
* Open a connection to the analysis server using the given URL.
*/
- Future<AnalysisManager> _openConnection(String serverUrl) {
+ Future<AnalysisManager> _openConnection(String serverUrl) async {
Function onError = (error) {
exitCode = 1;
if (process != null) {
@@ -111,13 +111,9 @@ class AnalysisManager {
throw 'Failed to connect to analysis server at $serverUrl\n $error';
};
try {
- return WebSocket
- .connect(serverUrl)
- .catchError(onError)
- .then((WebSocket socket) {
- this.channel = new WebSocketClientChannel(socket);
- return this;
- });
+ WebSocket socket = await WebSocket.connect(serverUrl).catchError(onError);
+ this.channel = new WebSocketClientChannel(socket);
+ return this;
} catch (error) {
onError(error);
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/search/element_references.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698