Skip to content

Commit 6445a69

Browse files
committed
[test] Fix double close in testCloseRace
Close the fd via the FileHandle rather than directly on the file descriptor so that it does not get closed again when the pipe is released. Fixes running test in parallel on Linux.
1 parent af6f986 commit 6445a69

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Tests/LanguageServerProtocolJSONRPCTests/ConnectionTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ class ConnectionTests: XCTestCase {
239239
expectation.fulfill()
240240
})
241241

242-
243-
close(to.fileHandleForWriting.fileDescriptor)
242+
to.fileHandleForWriting.closeFile()
244243
// 100 us was chosen empirically to encourage races.
245244
usleep(100)
246245
conn.close()

0 commit comments

Comments
 (0)