(path: string)
| 102 | } |
| 103 | |
| 104 | function readCgroupFile(path: string): string | null { |
| 105 | try { |
| 106 | return readFileSync(path, "utf8"); |
| 107 | } catch (error) { |
| 108 | const code = getErrorCode(error); |
| 109 | if (code !== "ENOENT" && code !== "ENOTDIR") { |
| 110 | warnCgroupReadFailure(path, error); |
| 111 | } |
| 112 | return null; |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | function getErrorCode(error: unknown): string | undefined { |
| 117 | if (typeof error !== "object" || error === null || !("code" in error)) { |
no test coverage detected