Do not check the executable status of gen_snapshot if it has not yet been downloaded (#52574)

This commit is contained in:
Jason Simmons 2020-03-19 15:01:02 -07:00 committed by GitHub
parent 601c8dbebb
commit bbc9d4f3a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -640,7 +640,8 @@ class FlutterValidator extends DoctorValidator {
globals.artifacts.getArtifactPath(Artifact.genSnapshot);
// Check that the binaries we downloaded for this platform actually run on it.
if (!_genSnapshotRuns(genSnapshotPath)) {
if (globals.fs.file(genSnapshotPath).existsSync()
&& !_genSnapshotRuns(genSnapshotPath)) {
final StringBuffer buf = StringBuffer();
buf.writeln(userMessages.flutterBinariesDoNotRun);
if (globals.platform.isLinux) {

View file

@ -529,6 +529,16 @@ void main() {
Platform: _kNoColorOutputPlatform,
});
testUsingContext('gen_snapshot binary not available', () async {
expect(await FlutterValidatorDoctor().diagnose(verbose: false), isTrue);
// gen_snapshot is downloaded on demand, and the doctor should not
// fail if the gen_snapshot binary is not present.
expect(testLogger.statusText, contains('No issues found!'));
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(),
});
testUsingContext('version checking does not work', () async {
final VersionCheckError versionCheckError = VersionCheckError('version error');