Fix building on Fedora 39 and Ubuntu 24.04 (#354)

### Motivation:

Fixes https://github.com/apple/swift-log/issues/278.

### Modifications:

Fixed tests to successfully compile on Fedora 39 and Ubuntu 24.04, which
they previously failed on.

### Result:

Ability to run tests on these two platforms again.
This commit is contained in:
Honza Dvorsky authored and GitHub committed 2025-03-12 11:48:26 +00:00
1 parent 3a9d8c908f
commit 3d8596ed08
1 file changed
+9 -3
+9 -3
View File
@@ -1145,13 +1145,19 @@ class LoggingTest: XCTestCase {
let err = _pipe($0.baseAddress, 256, _O_BINARY)
XCTAssertEqual(err, 0, "_pipe failed \(err)")
}
let writeFD = _fdopen(fds[1], "w")
guard let writeFD = _fdopen(fds[1], "w") else {
XCTFail("Failed to open file")
return
}
#else
fds.withUnsafeMutableBufferPointer { ptr in
let err = pipe(ptr.baseAddress!)
XCTAssertEqual(err, 0, "pipe failed \(err)")
}
let writeFD = fdopen(fds[1], "w")
guard let writeFD = fdopen(fds[1], "w") else {
XCTFail("Failed to open file")
return
}
#endif
let writeBuffer = UnsafeMutablePointer<Int8>.allocate(capacity: 256)
@@ -1183,7 +1189,7 @@ class LoggingTest: XCTestCase {
}
// the actual test
body(writeFD!, readFD, readBuffer)
body(writeFD, readFD, readBuffer)
for fd in fds {
#if os(Windows)