Upgrade to latest process runner, fix commands that throw to fail test (flutter/engine#21827)
This fixes the lint script to fail when the clang-tidy command itself fails to execute, and print the exception that was raised.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
import 'dart:async' show Completer;
|
||||
import 'dart:convert' show jsonDecode, utf8, LineSplitter;
|
||||
import 'dart:io' show File, exit, Directory, FileSystemEntity, Platform, stderr;
|
||||
import 'dart:io' show File, exit, Directory, FileSystemEntity, Platform, stderr, exitCode;
|
||||
|
||||
import 'package:args/args.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
@@ -223,7 +223,6 @@ void main(List<String> arguments) async {
|
||||
'commands associated with them and can be lint checked.');
|
||||
}
|
||||
|
||||
int exitCode = 0;
|
||||
final List<WorkerJob> jobs = <WorkerJob>[];
|
||||
for (Command command in changedFileBuildCommands) {
|
||||
final String relativePath = path.relative(command.file.path, from: repoPath.parent.path);
|
||||
@@ -245,16 +244,21 @@ void main(List<String> arguments) async {
|
||||
final ProcessPool pool = ProcessPool();
|
||||
|
||||
await for (final WorkerJob job in pool.startWorkers(jobs)) {
|
||||
if (job.result?.stdout.isEmpty ?? true) {
|
||||
if (job.result?.exitCode == 0) {
|
||||
continue;
|
||||
}
|
||||
print('❌ Failures for ${job.name}:');
|
||||
print(job.result.stdout);
|
||||
if (job.result == null) {
|
||||
print('\n❗ A clang-tidy job failed to run, aborting:\n${job.exception}');
|
||||
exitCode = 1;
|
||||
break;
|
||||
} else {
|
||||
print('❌ Failures for ${job.name}:');
|
||||
print(job.result.stdout);
|
||||
}
|
||||
exitCode = 1;
|
||||
}
|
||||
print('\n');
|
||||
if (exitCode == 0) {
|
||||
print('No lint problems found.');
|
||||
}
|
||||
exit(exitCode);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ dependencies:
|
||||
args: ^1.6.0
|
||||
path: ^1.7.0
|
||||
isolate: ^2.0.3
|
||||
process_runner: ^3.0.0
|
||||
process_runner: ^3.1.0
|
||||
|
||||
environment:
|
||||
sdk: '>=2.8.0 <3.0.0'
|
||||
|
||||
Reference in New Issue
Block a user