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