()
| 124 | } |
| 125 | |
| 126 | export function findAvailableLogFile(): string { |
| 127 | const candidates = ["firebase-debug.log"]; |
| 128 | for (let i = 1; i < 10; i++) { |
| 129 | candidates.push(`firebase-debug.${i}.log`); |
| 130 | } |
| 131 | |
| 132 | for (const c of candidates) { |
| 133 | const logFilename = path.join(process.cwd(), c); |
| 134 | try { |
| 135 | const fd = fs.openSync(logFilename, "r+"); |
| 136 | fs.closeSync(fd); |
| 137 | return logFilename; |
| 138 | } catch (e: any) { |
| 139 | if (e.code === "ENOENT") { |
| 140 | // File does not exist, which is fine |
| 141 | return logFilename; |
| 142 | } |
| 143 | // Any other error (EPERM, etc) means we won't be able to log to |
| 144 | // this file so we skip it. |
| 145 | } |
| 146 | } |
| 147 | throw new Error("Unable to obtain permissions for firebase-debug.log"); |
| 148 | } |
| 149 | |
| 150 | export function tryStringify(value: any) { |
| 151 | if (typeof value === "string") { |
no outgoing calls
no test coverage detected
searching dependent graphs…