diff --git a/apps/cnquery/cmd/login.go b/apps/cnquery/cmd/login.go index 0f00ca9ba0..d253650320 100644 --- a/apps/cnquery/cmd/login.go +++ b/apps/cnquery/cmd/login.go @@ -15,6 +15,7 @@ import ( "go.mondoo.com/cnquery/v9" "go.mondoo.com/cnquery/v9/cli/config" "go.mondoo.com/cnquery/v9/cli/sysinfo" + cnquery_providers "go.mondoo.com/cnquery/v9/providers" "go.mondoo.com/cnquery/v9/providers-sdk/v1/upstream" "go.mondoo.com/ranger-rpc" "go.mondoo.com/ranger-rpc/plugins/authentication/statictoken" @@ -47,6 +48,7 @@ You remain logged in until you explicitly log out using the 'logout' subcommand. viper.BindPFlag("name", cmd.Flags().Lookup("name")) }, Run: func(cmd *cobra.Command, args []string) { + defer cnquery_providers.Coordinator.Shutdown() token, _ := cmd.Flags().GetString("token") annotations, _ := cmd.Flags().GetStringToString("annotation") register(token, annotations) diff --git a/apps/cnquery/cmd/logout.go b/apps/cnquery/cmd/logout.go index 20cfdeef76..e3f2727c5e 100644 --- a/apps/cnquery/cmd/logout.go +++ b/apps/cnquery/cmd/logout.go @@ -12,6 +12,7 @@ import ( "github.com/spf13/viper" "go.mondoo.com/cnquery/v9/cli/config" "go.mondoo.com/cnquery/v9/cli/sysinfo" + cnquery_providers "go.mondoo.com/cnquery/v9/providers" "go.mondoo.com/cnquery/v9/providers-sdk/v1/upstream" "sigs.k8s.io/yaml" ) @@ -33,6 +34,7 @@ ensure the credentials cannot be used in the future. viper.BindPFlag("force", cmd.Flags().Lookup("force")) }, Run: func(cmd *cobra.Command, args []string) { + defer cnquery_providers.Coordinator.Shutdown() var err error // its perfectly fine not to have a config here, therefore we ignore errors