OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:analysis_server/src/channel.dart'; | 9 import 'package:analysis_server/src/channel.dart'; |
10 import 'package:analysis_server/src/domain_server.dart'; | 10 import 'package:analysis_server/src/domain_server.dart'; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 Future<bool> stop() { | 119 Future<bool> stop() { |
120 if (process == null) { | 120 if (process == null) { |
121 return channel.close().then((_) => false); | 121 return channel.close().then((_) => false); |
122 } | 122 } |
123 return channel | 123 return channel |
124 .sendRequest(new Request('0', ServerDomainHandler.SHUTDOWN_METHOD)) | 124 .sendRequest(new Request('0', ServerDomainHandler.SHUTDOWN_METHOD)) |
125 .timeout(new Duration(seconds: 2), onTimeout: () { | 125 .timeout(new Duration(seconds: 2), onTimeout: () { |
126 print('Expected shutdown response'); | 126 print('Expected shutdown response'); |
127 }) | 127 }) |
128 .then((Response response) { | 128 .then((Response response) { |
129 channel.close(); | 129 return channel.close().then((_) => process.exitCode); |
130 return process.exitCode; | |
131 }) | 130 }) |
132 .timeout(new Duration(seconds: 2), onTimeout: () { | 131 .timeout(new Duration(seconds: 2), onTimeout: () { |
133 print('Expected server to shutdown'); | 132 print('Expected server to shutdown'); |
134 process.kill(); | 133 process.kill(); |
135 }) | 134 }) |
136 .then((int result) { | 135 .then((int result) { |
137 if (result != null && result != 0) { | 136 if (result != null && result != 0) { |
138 exitCode = result; | 137 exitCode = result; |
139 } | 138 } |
140 return true; | 139 return true; |
141 }); | 140 }); |
142 } | 141 } |
143 } | 142 } |
OLD | NEW |