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).
This commit is contained in:
committed by
Danny Tuppeny
parent
11076bfb43
commit
7a810261fa
@@ -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))
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user