From 246bf60fb37693f40cbc9b21a688e2841467f285 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Thu, 29 Oct 2020 12:52:30 -0700 Subject: [PATCH] [flutter_tools] allow default driver log to fail due to IO error (#69316) --- packages/flutter_driver/lib/src/common/error.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/flutter_driver/lib/src/common/error.dart b/packages/flutter_driver/lib/src/common/error.dart index 5c427e34d7..47b8bbdd42 100644 --- a/packages/flutter_driver/lib/src/common/error.dart +++ b/packages/flutter_driver/lib/src/common/error.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:io' show stderr; +import 'dart:io' show stderr, FileSystemException; /// Standard error thrown by Flutter Driver API. class DriverError extends Error { @@ -51,5 +51,9 @@ typedef DriverLogCallback = void Function(String source, String message); /// /// The default implementation prints `"$source: $message"` to stderr. DriverLogCallback driverLog = (String source, String message) { - stderr.writeln('$source: $message'); + try { + stderr.writeln('$source: $message'); + } on FileSystemException { + // May encounter IO error: https://github.com/flutter/flutter/issues/69314 + } };