* Validate working directory
(cwd: string)
| 162 | * Validate working directory |
| 163 | */ |
| 164 | function validateCwd(cwd: string): void { |
| 165 | if (!cwd || typeof cwd !== "string") { |
| 166 | throw new Error("cwd must be a non-empty string") |
| 167 | } |
| 168 | if (!fs.existsSync(cwd)) { |
| 169 | throw new Error(`Working directory does not exist: ${cwd}`) |
| 170 | } |
| 171 | if (!fs.statSync(cwd).isDirectory()) { |
| 172 | throw new Error(`Path is not a directory: ${cwd}`) |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * Generate unique process ID |
no test coverage detected