Future<String>
checkForStartError(Process process)
Source
Future<String> checkForStartError(Process process) {
displayProgress("Verifying launch (PID ${process.pid})...");
int timeoutInMilliseconds = startupTimeout * 1000;
var completer = new Completer<String>();
var accumulated = 0;
new Timer.periodic(new Duration(milliseconds: 100), (t) {
var signalFile = fileInProjectDirectory(pidPathForPid(process.pid));
if (signalFile.existsSync()) {
t.cancel();
completer.complete(signalFile.readAsStringSync());
return;
}
accumulated += 100;
if (accumulated >= timeoutInMilliseconds) {
t.cancel();
completer.completeError(
new CLIException("Timed out waiting for application start."));
}
});
return completer.future;
}