[flutter_tools] process exception during linux_doctor is handled (#100159)

This commit is contained in:
Jesús S Guerrero 2022-03-17 16:15:22 -07:00 committed by GitHub
parent b39a9473f8
commit 03b4f2bf50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -169,6 +169,8 @@ class LinuxDoctorValidator extends DoctorValidator {
]);
} on ArgumentError {
// ignore error.
} on ProcessException {
// ignore error.
}
if (result == null || result.exitCode != 0) {
return null;

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/user_messages.dart';
import 'package:flutter_tools/src/doctor_validator.dart';
import 'package:flutter_tools/src/linux/linux_doctor.dart';
@ -90,6 +91,14 @@ FakeCommand _missingBinaryCommand(String binary) {
);
}
FakeCommand _missingBinaryException(String binary) {
return FakeCommand(
command: <String>[binary, '--version'],
exitCode: 1,
exception: ProcessException(binary, <String>[])
);
}
void main() {
testWithoutContext('Full validation when everything is available at the necessary version',() async {
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
@ -260,7 +269,7 @@ void main() {
testWithoutContext('Missing validation when clang++ is not available', () async {
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
_missingBinaryCommand('clang++'),
_missingBinaryException('clang++'),
_cmakePresentCommand('3.16.3'),
_ninjaPresentCommand('1.10.0'),
_pkgConfigPresentCommand('0.29'),