From 271dc1334cf8ce3c798dafeb9ac7113072195c93 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 9 May 2021 11:33:20 +0200 Subject: commands: proper backend close on RunE error --- commands/bridge_auth_addtoken.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'commands/bridge_auth_addtoken.go') diff --git a/commands/bridge_auth_addtoken.go b/commands/bridge_auth_addtoken.go index 272eab8c..c0458fda 100644 --- a/commands/bridge_auth_addtoken.go +++ b/commands/bridge_auth_addtoken.go @@ -27,13 +27,12 @@ func newBridgeAuthAddTokenCommand() *cobra.Command { options := bridgeAuthAddTokenOptions{} cmd := &cobra.Command{ - Use: "add-token [TOKEN]", - Short: "Store a new token", - PreRunE: loadBackendEnsureUser(env), - PostRunE: closeBackend(env), - RunE: func(cmd *cobra.Command, args []string) error { + Use: "add-token [TOKEN]", + Short: "Store a new token", + PreRunE: loadBackendEnsureUser(env), + RunE: closeBackend(env, func(cmd *cobra.Command, args []string) error { return runBridgeAuthAddToken(env, options, args) - }, + }), Args: cobra.MaximumNArgs(1), } -- cgit