(fn, handle, ...args)
| 1102 | } |
| 1103 | |
| 1104 | async function fsCall(fn, handle, ...args) { |
| 1105 | assert(handle[kRefs] !== undefined, |
| 1106 | 'handle must be an instance of FileHandle'); |
| 1107 | |
| 1108 | if (handle.fd === -1) { |
| 1109 | // eslint-disable-next-line no-restricted-syntax |
| 1110 | const err = new Error(handle[kCloseReason] ?? 'file closed'); |
| 1111 | err.code = 'EBADF'; |
| 1112 | err.syscall = fn.name; |
| 1113 | throw err; |
| 1114 | } |
| 1115 | |
| 1116 | try { |
| 1117 | handle[kRef](); |
| 1118 | return await fn(handle, ...new SafeArrayIterator(args)); |
| 1119 | } finally { |
| 1120 | handle[kUnref](); |
| 1121 | } |
| 1122 | } |
| 1123 | |
| 1124 | function checkAborted(signal) { |
| 1125 | if (signal?.aborted) |
no test coverage detected
searching dependent graphs…