Make flutter tools crash log writing fail gracefully (#6122)

This commit is contained in:
John McCutchan 2016-09-28 12:44:18 -07:00 committed by GitHub
parent d9bbd2fb53
commit 8da84b1c2d

View file

@ -155,7 +155,18 @@ Future<File> _createCrashReport(List<String> args, dynamic error, Chain chain) a
buffer.writeln('## flutter doctor\n');
buffer.writeln('```\n${await _doctorText()}```');
crashFile.writeAsStringSync(buffer.toString());
try {
crashFile.writeAsStringSync(buffer.toString());
} on FileSystemException catch (_) {
// Fallback to the system temporary directory.
crashFile = getUniqueFile(Directory.systemTemp, 'flutter', 'log');
try {
crashFile.writeAsStringSync(buffer.toString());
} on FileSystemException catch (e) {
printError('Could not write crash report to disk: $e');
printError(buffer.toString());
}
}
return crashFile;
}