Commit 7a810261 authored by Danny Tuppeny's avatar Danny Tuppeny Committed by Danny Tuppeny

Only wait up to 3 seconds for emulator

Emaultor keeps running on a seuccessful launch, so this automatically returns after 3 seconds if the process hasn't quit (we have to wait for some period to get stderr in the case of a failure).
parent 11076bfb
......@@ -42,12 +42,20 @@ class AndroidEmulator extends Emulator {
@override
Future<void> launch() async {
final RunResult launchResult =
await runAsync(<String>[getEmulatorPath(), '-avd', id]);
if (launchResult.exitCode != 0) {
printError('$launchResult');
}
final Future<void> launchResult =
runAsync(<String>[getEmulatorPath(), '-avd', id])
.then((RunResult runResult) {
if (runResult.exitCode != 0) {
printError('$runResult');
}
});
// emulator continues running on a successful launch so if we
// haven't quit within 3 seconds we assume that's a success and just
// return.
await Future.any<void>(<Future<void>>[
launchResult,
new Future<void>.delayed(const Duration(seconds: 3))
]);
}
}
......
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