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';
6
6
7
7
import '../../src/macos/xcode.dart' ;
8
8
import '../base/common.dart' ;
9
+ import '../base/error_handling_io.dart' ;
9
10
import '../base/file_system.dart' ;
10
11
import '../base/logger.dart' ;
11
12
import '../build_info.dart' ;
@@ -118,6 +119,16 @@ class CleanCommand extends FlutterCommand {
118
119
119
120
@visibleForTesting
120
121
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) {
121
132
// This will throw a FileSystemException if the directory is missing permissions.
122
133
try {
123
134
if (! file.existsSync ()) {
Original file line number Diff line number Diff line change 5
5
import 'package:args/command_runner.dart' ;
6
6
import 'package:file/memory.dart' ;
7
7
import 'package:file_testing/file_testing.dart' ;
8
+ import 'package:flutter_tools/src/base/error_handling_io.dart' ;
8
9
import 'package:flutter_tools/src/base/file_system.dart' ;
9
10
import 'package:flutter_tools/src/base/logger.dart' ;
10
11
import 'package:flutter_tools/src/base/platform.dart' ;
@@ -234,7 +235,13 @@ void main() {
234
235
'$CleanCommand handles missing delete permissions' ,
235
236
() async {
236
237
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
+ );
238
245
final File throwingFile = fileSystem.file ('bad' )..createSync ();
239
246
handler.addError (
240
247
throwingFile,
You can’t perform that action at this time.
0 commit comments