()
| 31 | } |
| 32 | |
| 33 | export async function clearCwdEnvFiles(): Promise<void> { |
| 34 | try { |
| 35 | const dir = await getSessionEnvDirPath() |
| 36 | const files = await readdir(dir) |
| 37 | await Promise.all( |
| 38 | files |
| 39 | .filter( |
| 40 | f => |
| 41 | (f.startsWith('filechanged-hook-') || |
| 42 | f.startsWith('cwdchanged-hook-')) && |
| 43 | HOOK_ENV_REGEX.test(f), |
| 44 | ) |
| 45 | .map(f => writeFile(join(dir, f), '')), |
| 46 | ) |
| 47 | } catch (e: unknown) { |
| 48 | const code = getErrnoCode(e) |
| 49 | if (code !== 'ENOENT') { |
| 50 | logForDebugging(`Failed to clear cwd env files: ${errorMessage(e)}`) |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | export function invalidateSessionEnvCache(): void { |
| 56 | logForDebugging('Invalidating session environment cache') |
no test coverage detected