Unverified Commit 99d09548 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] ensure ErrorHandlingFileSystem wraps current directory (#66680)

The lack of current directory wrapping was letting some of the already handled errors through

Fixes #66675
parent fd0e223b
...@@ -45,6 +45,9 @@ class ErrorHandlingFileSystem extends ForwardingFileSystem { ...@@ -45,6 +45,9 @@ class ErrorHandlingFileSystem extends ForwardingFileSystem {
final Platform _platform; final Platform _platform;
@override
Directory get currentDirectory => directory(delegate.currentDirectory);
@override @override
File file(dynamic path) => ErrorHandlingFile( File file(dynamic path) => ErrorHandlingFile(
platform: _platform, platform: _platform,
......
...@@ -300,7 +300,6 @@ void main() { ...@@ -300,7 +300,6 @@ void main() {
}); });
}); });
group('throws ToolExit on macOS', () { group('throws ToolExit on macOS', () {
const int eperm = 1; const int eperm = 1;
const int enospc = 28; const int enospc = 28;
...@@ -445,6 +444,24 @@ void main() { ...@@ -445,6 +444,24 @@ void main() {
expect(mockFile.toString(), isNotNull); expect(mockFile.toString(), isNotNull);
expect(fs.file('file').toString(), equals(mockFile.toString())); expect(fs.file('file').toString(), equals(mockFile.toString()));
}); });
testWithoutContext('ErrorHandlingDirectory', () {
final MockFileSystem mockFileSystem = MockFileSystem();
final FileSystem fs = ErrorHandlingFileSystem(
delegate: mockFileSystem,
platform: const LocalPlatform(),
);
final MockDirectory mockDirectory = MockDirectory();
when(mockFileSystem.directory(any)).thenReturn(mockDirectory);
expect(mockDirectory.toString(), isNotNull);
expect(fs.directory('directory').toString(), equals(mockDirectory.toString()));
when(mockFileSystem.currentDirectory).thenReturn(mockDirectory);
expect(fs.currentDirectory.toString(), equals(mockDirectory.toString()));
expect(fs.currentDirectory, isA<ErrorHandlingDirectory>());
});
}); });
group('ProcessManager on windows throws tool exit', () { group('ProcessManager on windows throws tool exit', () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment