Skip to content

Commit 5ec1261

Browse files
committed
Wait an extra second if we can't delete the directory yet
1 parent 184bbd3 commit 5ec1261

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

dwds/test/fixtures/context.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ class TestContext {
548548
_client?.close();
549549
await _outputDir?.delete(recursive: true);
550550
stopLogWriter();
551-
project.tearDown();
551+
await project.tearDown();
552552

553553
// clear the state for next setup
554554
_webDriver = null;

dwds/test/fixtures/project.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,16 @@ class TestProject {
252252
}
253253

254254
/// Delete the project if we made a copy.
255-
void tearDown() {
255+
Future<void> tearDown() async {
256256
if (editable) {
257-
_fixturesCopy.deleteSync(recursive: true);
257+
try {
258+
_fixturesCopy.deleteSync(recursive: true);
259+
} on FileSystemException catch (_) {
260+
// On Windows, the build daemon process might still be accessing the
261+
// working directory, so wait a second and then try again.
262+
await Future.delayed(const Duration(seconds: 1));
263+
_fixturesCopy.deleteSync(recursive: true);
264+
}
258265
}
259266
}
260267

0 commit comments

Comments
 (0)