Return the daemon socket/pipe address.
()
| 37 | |
| 38 | |
| 39 | def daemon_socket_path() -> str: |
| 40 | """Return the daemon socket/pipe address.""" |
| 41 | if sys.platform == "win32": |
| 42 | import hashlib |
| 43 | |
| 44 | # Hash the runtime dir so COCOINDEX_CODE_RUNTIME_DIR (or the |
| 45 | # COCOINDEX_CODE_DIR fallback) overrides produce unique pipe names, |
| 46 | # preventing conflicts between different daemon instances (tests, |
| 47 | # users, etc.) |
| 48 | dir_hash = hashlib.md5(str(daemon_runtime_dir()).encode()).hexdigest()[:12] |
| 49 | return rf"\\.\pipe\cocoindex_code_{dir_hash}" |
| 50 | return str(daemon_runtime_dir() / "daemon.sock") |
| 51 | |
| 52 | |
| 53 | def daemon_pid_path() -> Path: |