()
| 111 | * transparently, but we use the pipe format on Windows for Node.js compat. |
| 112 | */ |
| 113 | export function getDefaultUdsSocketPath(): string { |
| 114 | if (defaultSocketPath) return defaultSocketPath |
| 115 | const nonce = randomBytes(8).toString('hex') |
| 116 | if (process.platform === 'win32') { |
| 117 | defaultSocketPath = `\\\\.\\pipe\\claude-code-${process.pid}-${nonce}` |
| 118 | return defaultSocketPath |
| 119 | } |
| 120 | |
| 121 | defaultSocketPath = join( |
| 122 | tmpdir(), |
| 123 | 'cc-socks', |
| 124 | `${process.pid}-${nonce}`, |
| 125 | 'messaging.sock', |
| 126 | ) |
| 127 | assertValidUnixSocketPath(defaultSocketPath) |
| 128 | return defaultSocketPath |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * Returns the socket path of the currently running server, or undefined |
no test coverage detected