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
@@ -506,11 +507,17 @@ final class BackgroundIndexingTests: XCTestCase {
506507 """
507508 )
508509
509- try headerNewMarkedContents. write (
510- to: try XCTUnwrap ( uri. fileURL) ,
511- atomically: true ,
512- encoding: . utf8
513- )
510+ // clangd might have Header.h open, which prevents us from updating it. Keep retrying until we get a successful
511+ // write. This matches what a user would do.
512+ try await repeatUntilExpectedResult {
513+ do {
514+ try headerNewMarkedContents. write ( to: try XCTUnwrap ( uri. fileURL) , atomically: true , encoding: . utf8)
515+ return true
516+ } catch {
517+ logger. error ( " Writing new Header.h failed, will retry: \( error. forLogging) " )
518+ return false
519+ }
520+ }
514521
515522 project. testClient. send ( DidChangeWatchedFilesNotification ( changes: [ FileEvent ( uri: uri, type: . changed) ] ) )
516523 try await project. testClient. send ( PollIndexRequest ( ) )
You can’t perform that action at this time.
0 commit comments