fix: relocate daemon socket for deep paths (GH#1001)
On Unix systems, socket paths are limited to 104 chars (macOS) or 108 chars
(Linux). Deep workspace paths like /Volumes/External Drive/Dropbox/...
would exceed this limit and cause daemon startup failures.
This fix:
- Adds ShortSocketPath() which computes /tmp/beads-{hash}/bd.sock for
paths that would exceed the limit
- Keeps backward compatibility: short paths still use .beads/bd.sock
- Updates daemon discovery to check both locations
- Uses SHA256 hash of canonical workspace path for unique directories
Closes GH#1001
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -340,6 +340,11 @@ func TestDaemonAutostart_RestartDaemonForVersionMismatch_Stubbed(t *testing.T) {
|
||||
t.Fatalf("getPIDFilePath: %v", err)
|
||||
}
|
||||
sock := getSocketPath()
|
||||
// Create socket directory if needed (GH#1001 - socket may be in /tmp/beads-{hash}/)
|
||||
sockDir := filepath.Dir(sock)
|
||||
if err := os.MkdirAll(sockDir, 0o750); err != nil {
|
||||
t.Fatalf("MkdirAll sockDir: %v", err)
|
||||
}
|
||||
if err := os.WriteFile(pidFile, []byte("999999\n"), 0o600); err != nil {
|
||||
t.Fatalf("WriteFile pid: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user