fix(tmux): Use exact matching for HasSession to prevent prefix matches
tmux has-session -t does prefix matching by default, so "gt-deacon-boot" would match when checking for "gt-deacon". This caused gt start to think the Deacon was running when only a stale gt-deacon-boot session existed. Using "=" prefix forces exact matching in tmux. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -131,9 +131,11 @@ func (t *Tmux) IsAvailable() bool {
|
||||
return cmd.Run() == nil
|
||||
}
|
||||
|
||||
// HasSession checks if a session exists.
|
||||
// HasSession checks if a session exists (exact match).
|
||||
// Uses "=" prefix for exact matching, preventing prefix matches
|
||||
// (e.g., "gt-deacon-boot" won't match when checking for "gt-deacon").
|
||||
func (t *Tmux) HasSession(name string) (bool, error) {
|
||||
_, err := t.run("has-session", "-t", name)
|
||||
_, err := t.run("has-session", "-t", "="+name)
|
||||
if err != nil {
|
||||
if errors.Is(err, ErrSessionNotFound) || errors.Is(err, ErrNoServer) {
|
||||
return false, nil
|
||||
|
||||
Reference in New Issue
Block a user