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