mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:37:12 +00:00
Wait for InstrumentationService.shutdown() before exit(0).
Otherwise we don't get the last portion of instrumentation data in the file at all. R=brianwilkerson@google.com BUG= Review URL: https://codereview.chromium.org/1413403007 .
This commit is contained in:
parent
1ea74a407b
commit
d49d0f7e06
|
@ -428,11 +428,11 @@ class Driver implements ServerStarter {
|
|||
}
|
||||
|
||||
_captureExceptions(service, () {
|
||||
stdioServer.serveStdio().then((_) {
|
||||
stdioServer.serveStdio().then((_) async {
|
||||
if (serve_http) {
|
||||
httpServer.close();
|
||||
}
|
||||
service.shutdown();
|
||||
await service.shutdown();
|
||||
exit(0);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
library file_instrumentation;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:analyzer/instrumentation/instrumentation.dart';
|
||||
|
@ -30,8 +31,8 @@ class FileInstrumentationServer implements InstrumentationServer {
|
|||
}
|
||||
|
||||
@override
|
||||
void shutdown() {
|
||||
_sink.close();
|
||||
Future shutdown() async {
|
||||
await _sink.close();
|
||||
_sink = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
library instrumentation;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:analyzer/task/model.dart';
|
||||
|
@ -43,7 +44,7 @@ abstract class InstrumentationServer {
|
|||
* server. This method should be invoked exactly one time and no other methods
|
||||
* should be invoked on this instance after this method has been invoked.
|
||||
*/
|
||||
void shutdown();
|
||||
Future shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,7 +84,7 @@ class InstrumentationService {
|
|||
int _subprocessCounter = 0;
|
||||
|
||||
/**
|
||||
* Initialize a newly created instrumentation service to comunicate with the
|
||||
* Initialize a newly created instrumentation service to communicate with the
|
||||
* given [instrumentationServer].
|
||||
*/
|
||||
InstrumentationService(this._instrumentationServer);
|
||||
|
@ -290,9 +291,9 @@ class InstrumentationService {
|
|||
* server. This method should be invoked exactly one time and no other methods
|
||||
* should be invoked on this instance after this method has been invoked.
|
||||
*/
|
||||
void shutdown() {
|
||||
Future shutdown() async {
|
||||
if (_instrumentationServer != null) {
|
||||
_instrumentationServer.shutdown();
|
||||
await _instrumentationServer.shutdown();
|
||||
_instrumentationServer = null;
|
||||
}
|
||||
}
|
||||
|
@ -373,9 +374,9 @@ class MulticastInstrumentationServer implements InstrumentationServer {
|
|||
}
|
||||
|
||||
@override
|
||||
void shutdown() {
|
||||
Future shutdown() async {
|
||||
for (InstrumentationServer server in _servers) {
|
||||
server.shutdown();
|
||||
await server.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
library test.instrumentation;
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:analyzer/instrumentation/instrumentation.dart';
|
||||
import 'package:unittest/unittest.dart';
|
||||
|
||||
|
@ -174,7 +176,7 @@ class TestInstrumentationServer implements InstrumentationServer {
|
|||
}
|
||||
|
||||
@override
|
||||
void shutdown() {
|
||||
Future shutdown() async {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue