(target, prop, receiver)
| 59 | function createLocalTomlFailingKaos(base: Kaos): Kaos { |
| 60 | return new Proxy(base, { |
| 61 | get(target, prop, receiver) { |
| 62 | if (prop === 'readText') { |
| 63 | return ( |
| 64 | path: string, |
| 65 | options?: { encoding?: BufferEncoding; errors?: 'strict' | 'replace' | 'ignore' }, |
| 66 | ) => { |
| 67 | if (String(path).endsWith('local.toml')) { |
| 68 | return Promise.reject( |
| 69 | new Error(`acp: readTextFile failed for ${path}: unknown session (issue #988)`), |
| 70 | ); |
| 71 | } |
| 72 | return target.readText(path, options); |
| 73 | }; |
| 74 | } |
| 75 | if (prop === 'withCwd') { |
| 76 | return (cwd: string) => createLocalTomlFailingKaos(target.withCwd(cwd)); |
| 77 | } |
| 78 | const value = Reflect.get(target, prop, receiver); |
| 79 | return typeof value === 'function' ? (value as (...args: unknown[]) => unknown).bind(target) : value; |
| 80 | }, |
| 81 | }); |
| 82 | } |
| 83 |
nothing calls this directly
no test coverage detected