mirror of
https://github.com/Yeachan-Heo/oh-my-claudecode.git
synced 2026-09-03 06:25:33 +08:00
On Windows, Node.js mkdirSync({ recursive: true }) can throw EEXIST
when multiple hook processes race to create the same directory. The
existsSync() pre-check introduces a TOCTOU window that recursive:true
alone cannot close. Add EEXIST catch to all vulnerable mkdir sites.
Fixes: ensureOmcDir, ensureAllOmcDirs, ensureSessionStateDir in
worktree-paths.ts, plus unguarded mkdirSync in context-guard-stop.mjs
and session-summary.mjs. Pattern matches atomic-write.ts:ensureDirSync.
Constraint: Must not change behavior on POSIX (EEXIST catch is a no-op)
Rejected: Extract shared ensureMkdir utility | .mjs scripts cannot import TS; minimal diff preferred for bugfix
Confidence: high
Scope-risk: narrow
Not-tested: Actual Windows parallel-hook reproduction (no Windows CI)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6.6 KiB
Executable File
6.6 KiB
Executable File