()
| 51 | } |
| 52 | |
| 53 | export async function clearCwdEnvFiles(): Promise<void> { |
| 54 | try { |
| 55 | const dir = await getSessionEnvDirPath() |
| 56 | if (!dir) return |
| 57 | const files = await readdir(dir) |
| 58 | await Promise.all( |
| 59 | files |
| 60 | .filter( |
| 61 | f => |
| 62 | (f.startsWith('filechanged-hook-') || |
| 63 | f.startsWith('cwdchanged-hook-')) && |
| 64 | HOOK_ENV_REGEX.test(f), |
| 65 | ) |
| 66 | .map(f => writeFile(join(dir, f), '')), |
| 67 | ) |
| 68 | } catch (e: unknown) { |
| 69 | const code = getErrnoCode(e) |
| 70 | if (code !== 'ENOENT') { |
| 71 | logForDebugging(`Failed to clear cwd env files: ${errorMessage(e)}`) |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | export function invalidateSessionEnvCache(): void { |
| 77 | logForDebugging('Invalidating session environment cache') |
no test coverage detected