File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -585,12 +585,22 @@ final class WorkspaceTests: XCTestCase {
585
585
let packageBManifestPath = project. scratchDirectory
586
586
. appendingPathComponent ( " PackageB " )
587
587
. appendingPathComponent ( " Package.swift " )
588
- try newPackageManifest. write (
589
- to: packageBManifestPath,
590
- atomically: true ,
591
- encoding: . utf8
592
- )
593
588
589
+ // Package resolving can open Package.swift in exclusive mode on Windows, which prevents us from writing the new
590
+ // package manifest. Keep retrying until we get a successful write. This matches what a user would do.
591
+ try await repeatUntilExpectedResult {
592
+ do {
593
+ try newPackageManifest. write (
594
+ to: packageBManifestPath,
595
+ atomically: true ,
596
+ encoding: . utf8
597
+ )
598
+ return true
599
+ } catch {
600
+ logger. error ( " Writing new package manifest failed, will retry: \( error. forLogging) " )
601
+ return false
602
+ }
603
+ }
594
604
project. testClient. send (
595
605
DidChangeWatchedFilesNotification ( changes: [
596
606
FileEvent ( uri: DocumentURI ( packageBManifestPath) , type: . changed)
You can’t perform that action at this time.
0 commit comments