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 library driver; | 5 library driver; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'dart:math'; | 9 import 'dart:math'; |
10 | 10 |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 serverPlugin, packageResolverProvider); | 421 serverPlugin, packageResolverProvider); |
422 httpServer = new HttpAnalysisServer(socketServer); | 422 httpServer = new HttpAnalysisServer(socketServer); |
423 stdioServer = new StdioAnalysisServer(socketServer); | 423 stdioServer = new StdioAnalysisServer(socketServer); |
424 socketServer.userDefinedPlugins = _userDefinedPlugins; | 424 socketServer.userDefinedPlugins = _userDefinedPlugins; |
425 | 425 |
426 if (serve_http) { | 426 if (serve_http) { |
427 httpServer.serveHttp(port); | 427 httpServer.serveHttp(port); |
428 } | 428 } |
429 | 429 |
430 _captureExceptions(service, () { | 430 _captureExceptions(service, () { |
431 stdioServer.serveStdio().then((_) { | 431 stdioServer.serveStdio().then((_) async { |
432 if (serve_http) { | 432 if (serve_http) { |
433 httpServer.close(); | 433 httpServer.close(); |
434 } | 434 } |
435 service.shutdown(); | 435 await service.shutdown(); |
436 exit(0); | 436 exit(0); |
437 }); | 437 }); |
438 }, | 438 }, |
439 print: | 439 print: |
440 results[INTERNAL_PRINT_TO_CONSOLE] ? null : httpServer.recordPrint); | 440 results[INTERNAL_PRINT_TO_CONSOLE] ? null : httpServer.recordPrint); |
441 } | 441 } |
442 | 442 |
443 /** | 443 /** |
444 * Execute the given [callback] within a zone that will capture any unhandled | 444 * Execute the given [callback] within a zone that will capture any unhandled |
445 * exceptions and both report them to the client and send them to the given | 445 * exceptions and both report them to the client and send them to the given |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 uuidFile.parent.createSync(recursive: true); | 571 uuidFile.parent.createSync(recursive: true); |
572 uuidFile.writeAsStringSync(uuid); | 572 uuidFile.writeAsStringSync(uuid); |
573 } catch (exception, stackTrace) { | 573 } catch (exception, stackTrace) { |
574 service.logPriorityException(exception, stackTrace); | 574 service.logPriorityException(exception, stackTrace); |
575 // Slightly alter the uuid to indicate it was not persisted | 575 // Slightly alter the uuid to indicate it was not persisted |
576 uuid = 'temp-$uuid'; | 576 uuid = 'temp-$uuid'; |
577 } | 577 } |
578 return uuid; | 578 return uuid; |
579 } | 579 } |
580 } | 580 } |
OLD | NEW |