MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / clearCwdEnvFiles

Function clearCwdEnvFiles

source code/utils/sessionEnvironment.ts:35–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33}
34
35export 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
57export function invalidateSessionEnvCache(): void {
58 logForDebugging('Invalidating session environment cache')

Callers 1

onCwdChangedForHooksFunction · 0.85

Calls 5

getSessionEnvDirPathFunction · 0.85
readdirFunction · 0.85
getErrnoCodeFunction · 0.85
logForDebuggingFunction · 0.85
errorMessageFunction · 0.70

Tested by

no test coverage detected