sdk
sdk copied to clipboard
Directory.deleteSync(recursive: true) failing if directory is not empty
Observed on the following Dart version:
$ dart --version
Dart VM version: 2.5.0-dev.3.0.flutter-35382f9b14 (Wed Aug 28 18:50:51 2019 +0000) on "macos_x64"
FileSystemException: Deletion failed, path = '/private/var/folders/dy/cv4xnlnn7sb_4bz47wvmdwjw003g3j/T/file_test_JGEQQ7' (OS Error: Directory not empty, errno = 66)
dart:io FileSystemEntity.deleteSync
test/chroot_test.dart 45:13 main.<fn>.<fn>.<fn>
The test in question has the following setUp() and tearDown() methods - the exception was thrown in tearDown();
io.Directory tmp;
setUp(() {
tmp = io.Directory.systemTemp.createTempSync('file_test_');
tmp = io.Directory(tmp.resolveSymbolicLinksSync());
});
tearDown(() {
tmp.deleteSync(recursive: true);
});
This failure is intermittent - not 100% reproducible.
Prior art:
- https://github.com/dart-lang/sdk/issues/16264
- https://github.com/dart-lang/sdk/issues/1757
Except both those are closed, and I just saw this happen today against BE Dart.
I can confirm. And I'm surprised how noone came across this yet.
I think this affects this aswell: https://github.com/flutter/flutter/issues/64410
Thankyou!
This is an issue I am seeing as well, it is intermittent.