| 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..00602e4183b096714e03d7a4420d3ddf1d6ff9d9 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,26 @@ class AnalysisManager {
|
| */
|
| Future<bool> stop() {
|
| if (process == null) {
|
| - return new Future.value(false);
|
| + return channel.close().then((_) => 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;
|
| });
|
| }
|
| -
|
| }
|
|
|