Skip to content

Commit b7ddd54

Browse files
committed
docs(claude): add critical rule about shell: WIN32 pattern
1 parent d4127c2 commit b7ddd54

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CLAUDE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,18 @@ Decision tree:
374374
- **Order**: Alphabetical; private first, then exported
375375
- **Await in loops**: Add `// eslint-disable-next-line no-await-in-loop` when intentional
376376
- **Process spawning**: Use `@socketsecurity/registry/lib/spawn` not `child_process.spawn`
377+
- **spawn() with shell: WIN32**: 🚨 NEVER change `shell: WIN32` to `shell: true`
378+
- `shell: WIN32` is the correct cross-platform pattern (enables shell on Windows, disables on Unix)
379+
- If spawn fails with ENOENT, the issue is NOT the shell parameter
380+
- Fix by properly separating command and arguments instead:
381+
```javascript
382+
// WRONG - passing full command as string
383+
spawn('python3 -m module arg1 arg2', [], { shell: WIN32 })
384+
385+
// CORRECT - separate command and args
386+
spawn('python3', ['-m', 'module', 'arg1', 'arg2'], { shell: WIN32 })
387+
```
388+
- This pattern is canonical across all Socket Security codebases
377389
- **Working directory**: 🚨 NEVER use `process.chdir()` - use `{ cwd }` options and absolute paths instead
378390
- Breaks tests, worker threads, and causes race conditions
379391
- Always pass `{ cwd: absolutePath }` to spawn/exec/fs operations

0 commit comments

Comments
 (0)