Chromium Code Reviews| 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 15f1e6babeb07855551e07bc0f5b6d54fe4fd345..8c137615e3843c502236ef6eb358dc58489548dc 100644 |
| --- a/pkg/analysis_server/lib/src/analysis_manager.dart |
| +++ b/pkg/analysis_server/lib/src/analysis_manager.dart |
| @@ -5,6 +5,7 @@ |
| import 'dart:async'; |
| import 'dart:convert'; |
| import 'dart:io'; |
| + |
| import 'package:analysis_server/src/channel.dart'; |
| import 'package:analysis_server/src/domain_server.dart'; |
| import 'package:analysis_server/src/protocol.dart'; |
| @@ -117,22 +118,27 @@ class AnalysisManager { |
| */ |
| Future<bool> stop() { |
| if (process == null) { |
| + channel.close(); |
|
Bob Nystrom
2014/03/04 01:03:45
This should probably be async too:
return channel
danrubel
2014/03/05 15:32:04
Good point. Updated close() to return a Future and
nweiz
2014/03/05 20:16:39
Also below.
danrubel
2014/03/11 19:06:09
Done.
|
| return new Future.value(false); |
| } |
| - var request = new Request('0', ServerDomainHandler.SHUTDOWN_METHOD); |
| - channel.sendRequest(request); |
| - return process.exitCode |
| - .timeout(new Duration(seconds: 10)) |
| - .catchError((error) { |
| + return channel |
| + .sendRequest(new Request('0', ServerDomainHandler.SHUTDOWN_METHOD)) |
| + .timeout(new Duration(seconds: 2), onTimeout: () { |
| + print('Expected shutdown response'); |
| + }) |
| + .then((Response response) { |
| + channel.close(); |
| + return process.exitCode; |
| + }) |
| + .timeout(new Duration(seconds: 2), onTimeout: () { |
| + print('Expected server to shutdown'); |
| process.kill(); |
| - throw 'Expected server to shutdown'; |
| }) |
| - .then((result) { |
| - if (result != 0) { |
| + .then((int result) { |
| + if (result != null && result != 0) { |
| exitCode = result; |
| } |
| return true; |
| }); |
|
Bob Nystrom
2014/03/04 01:03:45
The logic looks good here, but I would format it l
danrubel
2014/03/05 15:32:04
I find the wrapped style makes it harder to read t
|
| } |
| - |
| } |