Function
wrapFdOp
(name, orig, fdArgIdx = 0)
Source from the content-addressed store, hash-verified
| 578 | |
| 579 | // Intercept fd operations to redirect fake directory fds |
| 580 | const wrapFdOp = (name, orig, fdArgIdx = 0) => { |
| 581 | return (...args) => { |
| 582 | const fd = args[fdArgIdx]; |
| 583 | if (fakeFdMap.has(fd)) { |
| 584 | args[fdArgIdx] = fakeFdMap.get(fd); |
| 585 | } |
| 586 | return orig(...args); |
| 587 | }; |
| 588 | }; |
| 589 | |
| 590 | // Custom fd_readdir for our directory handles |
| 591 | const origFdReaddir = wasiImport.fd_readdir; |
Tested by
no test coverage detected