mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
Make flutter tools crash log writing fail gracefully (#6122)
This commit is contained in:
parent
d9bbd2fb53
commit
8da84b1c2d
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue