( path: string, readFile: ReadFileFn = defaultReadFile, timeoutMs: number = READ_TIMEOUT_MS, )
| 13 | fsReadFile(path, { encoding: 'utf8', signal }); |
| 14 | |
| 15 | export async function readWithTimeout( |
| 16 | path: string, |
| 17 | readFile: ReadFileFn = defaultReadFile, |
| 18 | timeoutMs: number = READ_TIMEOUT_MS, |
| 19 | ): Promise<string> { |
| 20 | const signal = AbortSignal.timeout(timeoutMs); |
| 21 | return readFile(path, signal); |
| 22 | } |
| 23 | |
| 24 | export function parseCpuMax(content: string): number | null { |
| 25 | const trimmed = content.trim(); |
no test coverage detected