(dir: string)
| 169 | } |
| 170 | |
| 171 | async function assertPrivateCapabilityDir(dir: string): Promise<void> { |
| 172 | let stat: Awaited<ReturnType<typeof lstat>> |
| 173 | try { |
| 174 | stat = await lstat(dir) |
| 175 | } catch (error) { |
| 176 | if (!isNotFound(error)) throw error |
| 177 | await mkdir(dir, { recursive: true, mode: 0o700 }) |
| 178 | stat = await lstat(dir) |
| 179 | } |
| 180 | |
| 181 | assertPrivateDirectory(stat, dir, 'capability directory') |
| 182 | await chmod(dir, 0o700) |
| 183 | } |
| 184 | |
| 185 | function assertPrivateDirectory( |
| 186 | stat: Awaited<ReturnType<typeof lstat>>, |
no test coverage detected