[client] Stay connected with login command (#7384)

This commit is contained in:
Theodor Midtlien
2026-09-01 18:04:11 +02:00
committed by GitHub
parent ebc259e30b
commit e5c0cdf958
2 changed files with 7 additions and 2 deletions

View File

@@ -91,7 +91,7 @@ var loginCmd = &cobra.Command{
return fmt.Errorf("daemon login failed: %v", err)
}
cmd.Println("Logging successfully")
cmd.Println("Login successful")
return nil
},
@@ -343,7 +343,7 @@ func doForegroundLogin(ctx context.Context, cmd *cobra.Command, setupKey string,
if err != nil {
return fmt.Errorf("foreground login failed: %v", err)
}
cmd.Println("Logging successfully")
cmd.Println("Login successful")
return nil
}

View File

@@ -653,6 +653,11 @@ func (s *Server) Login(callerCtx context.Context, msg *proto.LoginRequest) (*pro
}
state := internal.CtxGetState(s.rootCtx)
status := state.CurrentStatus()
if status == internal.StatusConnected {
return &proto.LoginResponse{}, nil
}
defer func() {
status, err := state.Status()
if err != nil || (status != internal.StatusNeedsLogin && status != internal.StatusLoginFailed) {