[flutter_tools] catch error 32 in cache (#75719)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user