fix(crew): add dry-run support and error handling to crew stop (gt-kjcx4)
Fixed two issues in `gt crew stop <name>`: 1. --dry-run flag now works for individual crew stops (previously only worked with --all) 2. HasSession errors are now properly handled instead of being ignored, which could cause "No session found" messages even when sessions exist 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
a3bccc881b
commit
a787d60add
@@ -666,12 +666,23 @@ func runCrewStop(cmd *cobra.Command, args []string) error {
|
|||||||
sessionID := crewSessionName(r.Name, name)
|
sessionID := crewSessionName(r.Name, name)
|
||||||
|
|
||||||
// Check if session exists
|
// Check if session exists
|
||||||
hasSession, _ := t.HasSession(sessionID)
|
hasSession, err := t.HasSession(sessionID)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Error checking session %s: %v\n", sessionID, err)
|
||||||
|
lastErr = err
|
||||||
|
continue
|
||||||
|
}
|
||||||
if !hasSession {
|
if !hasSession {
|
||||||
fmt.Printf("No session found for %s/%s\n", r.Name, name)
|
fmt.Printf("No session found for %s/%s\n", r.Name, name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dry run - just show what would be stopped
|
||||||
|
if crewDryRun {
|
||||||
|
fmt.Printf("Would stop %s/%s (session: %s)\n", r.Name, name, sessionID)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Capture output before stopping (best effort)
|
// Capture output before stopping (best effort)
|
||||||
var output string
|
var output string
|
||||||
if !crewForce {
|
if !crewForce {
|
||||||
|
|||||||
Reference in New Issue
Block a user