Skip to content

Commit 08ed962

Browse files
committed
Don't abort the test if we can't open /proc/sys/kernel/io_uring_disabled
1 parent 08ea334 commit 08ed962

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Tests/SystemTests/IORingTests.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ import System
1111
#endif
1212

1313
func uringEnabled() throws -> Bool {
14-
let procPath = FilePath("/proc/sys/kernel/io_uring_disabled")
15-
let fd = try FileDescriptor.open(procPath, .readOnly)
16-
let buffer = UnsafeMutableRawBufferPointer.allocate(byteCount: 1024, alignment: 0)
17-
_ = try fd.read(into: buffer)
18-
if buffer.load(fromByteOffset: 0, as: Int.self) == 0 {
19-
return true
14+
do {
15+
let procPath = FilePath("/proc/sys/kernel/io_uring_disabled")
16+
let fd = try FileDescriptor.open(procPath, .readOnly)
17+
let buffer = UnsafeMutableRawBufferPointer.allocate(byteCount: 1024, alignment: 0)
18+
_ = try fd.read(into: buffer)
19+
if buffer.load(fromByteOffset: 0, as: Int.self) == 0 {
20+
return true
21+
}
22+
} catch (_) {
23+
return false
2024
}
2125
return false
2226
}

0 commit comments

Comments
 (0)