Commit 3352a3fb authored by Vyacheslav Egorov's avatar Vyacheslav Egorov Committed by Alexander Aprelev

Report an error if compilation during testing times out. (#15745)

* Report an error if compilation times out instead of waiting forever.

* Remove braces
parent 821c9b35
......@@ -144,10 +144,10 @@ class _Compiler {
printTrace('Compiling ${request.path}');
compiler ??= createCompiler();
suppressOutput = false;
final String outputPath = await compiler.recompile(request.path,
final String outputPath = await handleTimeout(compiler.recompile(request.path,
<String>[request.path],
outputPath: outputDill.path,
);
), request.path);
// Check if the compiler produced the output. If it failed then
// outputPath would be null. In this case pass null upwards to the
......@@ -180,13 +180,20 @@ class _Compiler {
Future<String> compile(String mainDart) {
final Completer<String> completer = new Completer<String>();
compilerController.add(new _CompilationRequest(mainDart, completer));
return completer.future;
return handleTimeout(completer.future, mainDart);
}
Future<dynamic> shutdown() async {
await compiler.shutdown();
compiler = null;
}
static Future<String> handleTimeout(Future<String> value, String path) {
return value.timeout(const Duration(minutes: 5), onTimeout: () {
printError('Compilation of $path timed out after 5 minutes.');
return null;
});
}
}
class _FlutterPlatform extends PlatformPlugin {
......
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