Fix tmux error handling for "no current target" (#755)
When starting crew without mayor running, tmux has-session can return "no current target" if no tmux server exists. This error was not mapped to ErrNoServer, causing crew start to fail instead of bootstrapping a new tmux server. Add "no current target" to the ErrNoServer detection so crew (and other agents) can start independently without requiring an existing tmux session. Reproduction: - Ensure no tmux server running (tmux kill-server) - Run: gt crew start <rig>/<name> - Before fix: "Error: checking session: tmux has-session: no current target" - After fix: Crew session starts successfully Co-authored-by: Shaun <TechnicallyShaun@users.noreply.github.com>
This commit is contained in:
@@ -63,7 +63,8 @@ func (t *Tmux) wrapError(err error, stderr string, args []string) error {
|
||||
|
||||
// Detect specific error types
|
||||
if strings.Contains(stderr, "no server running") ||
|
||||
strings.Contains(stderr, "error connecting to") {
|
||||
strings.Contains(stderr, "error connecting to") ||
|
||||
strings.Contains(stderr, "no current target") {
|
||||
return ErrNoServer
|
||||
}
|
||||
if strings.Contains(stderr, "duplicate session") {
|
||||
|
||||
@@ -198,6 +198,7 @@ func TestWrapError(t *testing.T) {
|
||||
}{
|
||||
{"no server running on /tmp/tmux-...", ErrNoServer},
|
||||
{"error connecting to /tmp/tmux-...", ErrNoServer},
|
||||
{"no current target", ErrNoServer},
|
||||
{"duplicate session: test", ErrSessionExists},
|
||||
{"session not found: test", ErrSessionNotFound},
|
||||
{"can't find session: test", ErrSessionNotFound},
|
||||
|
||||
Reference in New Issue
Block a user