(dirPath: string)
| 179 | } |
| 180 | |
| 181 | async function removeIfEmpty(dirPath: string): Promise<void> { |
| 182 | if ((await readSubdirs(dirPath)).length === 0) { |
| 183 | try { |
| 184 | await rm(dirPath, { recursive: true, force: true }) |
| 185 | } catch (error) { |
| 186 | logForDebugging(`Failed to remove empty dir: ${dirPath}: ${error}`) |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | async function readSubdirs(dirPath: string): Promise<string[]> { |
| 192 | try { |
no test coverage detected