File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
test/commands.shard/hermetic Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import 'package:meta/meta.dart';
66
77import '../../src/macos/xcode.dart' ;
88import '../base/common.dart' ;
9+ import '../base/error_handling_io.dart' ;
910import '../base/file_system.dart' ;
1011import '../base/logger.dart' ;
1112import '../build_info.dart' ;
@@ -118,6 +119,16 @@ class CleanCommand extends FlutterCommand {
118119
119120 @visibleForTesting
120121 void deleteFile (FileSystemEntity file) {
122+ try {
123+ ErrorHandlingFileSystem .noExitOnFailure (() {
124+ _deleteFile (file);
125+ });
126+ } on Exception catch (e) {
127+ globals.printError ('Failed to remove ${file .path }: $e ' );
128+ }
129+ }
130+
131+ void _deleteFile (FileSystemEntity file) {
121132 // This will throw a FileSystemException if the directory is missing permissions.
122133 try {
123134 if (! file.existsSync ()) {
Original file line number Diff line number Diff line change 55import 'package:args/command_runner.dart' ;
66import 'package:file/memory.dart' ;
77import 'package:file_testing/file_testing.dart' ;
8+ import 'package:flutter_tools/src/base/error_handling_io.dart' ;
89import 'package:flutter_tools/src/base/file_system.dart' ;
910import 'package:flutter_tools/src/base/logger.dart' ;
1011import 'package:flutter_tools/src/base/platform.dart' ;
@@ -234,7 +235,13 @@ void main() {
234235 '$CleanCommand handles missing delete permissions' ,
235236 () async {
236237 final FileExceptionHandler handler = FileExceptionHandler ();
237- final FileSystem fileSystem = MemoryFileSystem .test (opHandle: handler.opHandle);
238+
239+ // Ensures we handle ErrorHandlingFileSystem appropriately in prod.
240+ // See https://github.com/flutter/flutter/issues/108978.
241+ final FileSystem fileSystem = ErrorHandlingFileSystem (
242+ delegate: MemoryFileSystem .test (opHandle: handler.opHandle),
243+ platform: windowsPlatform,
244+ );
238245 final File throwingFile = fileSystem.file ('bad' )..createSync ();
239246 handler.addError (
240247 throwingFile,
You can’t perform that action at this time.
0 commit comments