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 13
13
import BuildSystemIntegration
14
14
import LanguageServerProtocol
15
15
import LanguageServerProtocolExtensions
16
+ import SKLogging
16
17
import SKOptions
17
18
import SKTestSupport
18
19
import SemanticIndex
@@ -506,11 +507,17 @@ final class BackgroundIndexingTests: XCTestCase {
506
507
"""
507
508
)
508
509
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
+ }
514
521
515
522
project. testClient. send ( DidChangeWatchedFilesNotification ( changes: [ FileEvent ( uri: uri, type: . changed) ] ) )
516
523
try await project. testClient. send ( PollIndexRequest ( ) )
You can’t perform that action at this time.
0 commit comments