File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 1313import BuildSystemIntegration
1414import LanguageServerProtocol
1515import LanguageServerProtocolExtensions
16+ import SKLogging
1617import SKOptions
1718import SKTestSupport
1819import SemanticIndex
@@ -507,11 +508,17 @@ final class BackgroundIndexingTests: XCTestCase {
507508 """
508509 )
509510
510- try headerNewMarkedContents. write (
511- to: try XCTUnwrap ( uri. fileURL) ,
512- atomically: true ,
513- encoding: . utf8
514- )
511+ // clangd might have Header.h open, which prevents us from updating it. Keep retrying until we get a successful
512+ // write. This matches what a user would do.
513+ try await repeatUntilExpectedResult {
514+ do {
515+ try headerNewMarkedContents. write ( to: try XCTUnwrap ( uri. fileURL) , atomically: true , encoding: . utf8)
516+ return true
517+ } catch {
518+ logger. error ( " Writing new Header.h failed, will retry: \( error. forLogging) " )
519+ return false
520+ }
521+ }
515522
516523 project. testClient. send ( DidChangeWatchedFilesNotification ( changes: [ FileEvent ( uri: uri, type: . changed) ] ) )
517524 try await project. testClient. send ( PollIndexRequest ( ) )
You can’t perform that action at this time.
0 commit comments