Commit e0670412 authored by Yegor's avatar Yegor Committed by GitHub

increase vmservice timeout; log stderr in microbenchmarks (#9088)

parent 72effdd2
...@@ -76,11 +76,17 @@ Future<Map<String, double>> _readJsonResults(Process process) { ...@@ -76,11 +76,17 @@ Future<Map<String, double>> _readJsonResults(Process process) {
bool jsonStarted = false; bool jsonStarted = false;
final StringBuffer jsonBuf = new StringBuffer(); final StringBuffer jsonBuf = new StringBuffer();
final Completer<Map<String, double>> completer = new Completer<Map<String, double>>(); final Completer<Map<String, double>> completer = new Completer<Map<String, double>>();
StreamSubscription<String> stdoutSub;
final StreamSubscription<String> stderrSub = process.stderr
.transform(const Utf8Decoder())
.transform(const LineSplitter())
.listen((String line) {
stderr.writeln('[STDERR] $line');
});
int prefixLength = 0; int prefixLength = 0;
bool processKilled = false; bool processWasKilledIntentionally = false;
stdoutSub = process.stdout final StreamSubscription<String> stdoutSub = process.stdout
.transform(const Utf8Decoder()) .transform(const Utf8Decoder())
.transform(const LineSplitter()) .transform(const LineSplitter())
.listen((String line) { .listen((String line) {
...@@ -94,8 +100,7 @@ Future<Map<String, double>> _readJsonResults(Process process) { ...@@ -94,8 +100,7 @@ Future<Map<String, double>> _readJsonResults(Process process) {
if (line.contains(jsonEnd)) { if (line.contains(jsonEnd)) {
jsonStarted = false; jsonStarted = false;
stdoutSub.cancel(); processWasKilledIntentionally = true;
processKilled = true;
process.kill(ProcessSignal.SIGINT); // flutter run doesn't quit automatically process.kill(ProcessSignal.SIGINT); // flutter run doesn't quit automatically
completer.complete(JSON.decode(jsonBuf.toString())); completer.complete(JSON.decode(jsonBuf.toString()));
return; return;
...@@ -106,7 +111,9 @@ Future<Map<String, double>> _readJsonResults(Process process) { ...@@ -106,7 +111,9 @@ Future<Map<String, double>> _readJsonResults(Process process) {
}); });
process.exitCode.then<int>((int code) { process.exitCode.then<int>((int code) {
if (!processKilled && code != 0) { stdoutSub.cancel();
stderrSub.cancel();
if (!processWasKilledIntentionally && code != 0) {
completer.completeError('flutter run failed: exit code=$code'); completer.completeError('flutter run failed: exit code=$code');
} }
}); });
......
...@@ -28,7 +28,7 @@ StreamChannel<String> _defaultOpenChannel(Uri uri) => ...@@ -28,7 +28,7 @@ StreamChannel<String> _defaultOpenChannel(Uri uri) =>
new IOWebSocketChannel.connect(uri.toString()).cast(); new IOWebSocketChannel.connect(uri.toString()).cast();
/// The default VM service request timeout. /// The default VM service request timeout.
const Duration kDefaultRequestTimeout = const Duration(seconds: 10); const Duration kDefaultRequestTimeout = const Duration(seconds: 30);
/// Used for RPC requests that may take a long time. /// Used for RPC requests that may take a long time.
const Duration kLongRequestTimeout = const Duration(minutes: 1); const Duration kLongRequestTimeout = const Duration(minutes: 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment