Cause flutter analyze to fail if the analysis server experienced an error. (#29126)
Substantially reduces the danger that a bug in the analysis server might prevent errors from being detected by `flutter analyze`.
This commit is contained in:
@@ -67,6 +67,9 @@ class AnalyzeContinuously extends AnalyzeBase {
|
||||
if (exitCode != 0)
|
||||
throwToolExit(message, exitCode: exitCode);
|
||||
printStatus(message);
|
||||
|
||||
if (server.didServerErrorOccur)
|
||||
throwToolExit('Server error(s) occurred.');
|
||||
}
|
||||
|
||||
void _handleAnalysisStatus(AnalysisServer server, bool isAnalyzing) {
|
||||
|
||||
@@ -155,6 +155,10 @@ class AnalyzeOnce extends AnalyzeBase {
|
||||
}
|
||||
}
|
||||
|
||||
if (server.didServerErrorOccur) {
|
||||
throwToolExit('Server error(s) occurred. (ran in ${seconds}s)');
|
||||
}
|
||||
|
||||
if (argResults['congratulate']) {
|
||||
if (undocumentedMembers > 0) {
|
||||
printStatus('No issues found! (ran in ${seconds}s; $dartdocMessage)');
|
||||
|
||||
@@ -27,6 +27,7 @@ class AnalysisServer {
|
||||
StreamController<bool>.broadcast();
|
||||
final StreamController<FileAnalysisErrors> _errorsController =
|
||||
StreamController<FileAnalysisErrors>.broadcast();
|
||||
bool _didServerErrorOccur = false;
|
||||
|
||||
int _id = 0;
|
||||
|
||||
@@ -61,6 +62,7 @@ class AnalysisServer {
|
||||
<String, dynamic>{'included': directories, 'excluded': <String>[]});
|
||||
}
|
||||
|
||||
bool get didServerErrorOccur => _didServerErrorOccur;
|
||||
Stream<bool> get onAnalyzing => _analyzingController.stream;
|
||||
Stream<FileAnalysisErrors> get onErrors => _errorsController.stream;
|
||||
|
||||
@@ -120,6 +122,7 @@ class AnalysisServer {
|
||||
if (error['stackTrace'] != null) {
|
||||
printError(error['stackTrace']);
|
||||
}
|
||||
_didServerErrorOccur = true;
|
||||
}
|
||||
|
||||
void _handleAnalysisIssues(Map<String, dynamic> issueInfo) {
|
||||
|
||||
Reference in New Issue
Block a user