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 {
585585 let packageBManifestPath = project. scratchDirectory
586586 . appendingPathComponent ( " PackageB " )
587587 . appendingPathComponent ( " Package.swift " )
588- try newPackageManifest. write (
589- to: packageBManifestPath,
590- atomically: true ,
591- encoding: . utf8
592- )
593588
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+ }
594604 project. testClient. send (
595605 DidChangeWatchedFilesNotification ( changes: [
596606 FileEvent ( uri: DocumentURI ( packageBManifestPath) , type: . changed)
You can’t perform that action at this time.
0 commit comments