Unverified Commit b05d6ec8 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] catch error 32 in cache (#75719)

parent 5b823cde
......@@ -1796,7 +1796,24 @@ class ArtifactUpdater {
final Directory destination = location.childDirectory(
tempFile.fileSystem.path.basenameWithoutExtension(tempFile.path)
);
ErrorHandlingFileSystem.deleteIfExists(destination, recursive: true);
try {
ErrorHandlingFileSystem.deleteIfExists(
destination,
recursive: true,
);
} on FileSystemException catch (error) {
// Error that indicates another program has this file open and that it
// cannot be deleted. For the cache, this is either the analyzer reading
// the sky_engine package or a running flutter_tester device.
const int kSharingViolation = 32;
if (_platform.isWindows && error.osError.errorCode == kSharingViolation) {
throwToolExit(
'Failed to delete ${destination.path} because the local file/directory is in use '
'by another process. Try closing any running IDEs or editors and trying '
'again'
);
}
}
_ensureExists(location);
try {
......
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