Skip to content

Commit ca31be7

Browse files
committed
fix: ensure cli exits after every run cleanly
1 parent 602ccce commit ca31be7

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
OWNER := dnitsch
22
NAME := aws-cli-auth
3-
VERSION := v0.7.8
3+
VERSION := v0.8.0
44
REVISION := $(shell git rev-parse --short HEAD)
55

66
LDFLAGS := -ldflags="-s -w -X \"github.com/dnitsch/aws-cli-auth/cmd.Version=$(VERSION)\" -X \"github.com/dnitsch/aws-cli-auth/cmd.Revision=$(REVISION)\" -extldflags -static"

cmd/clear.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,6 @@ func clear(cmd *cobra.Command, args []string) {
3939
if err := os.Remove(util.ConfigIniFile()); err != nil {
4040
util.Exit(err)
4141
}
42+
43+
util.CleanExit()
4244
}

cmd/saml.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"github.com/dnitsch/aws-cli-auth/internal/auth"
55
"github.com/dnitsch/aws-cli-auth/internal/config"
6+
"github.com/dnitsch/aws-cli-auth/internal/util"
67
"github.com/spf13/cobra"
78
)
89

@@ -38,5 +39,5 @@ func getSaml(cmd *cobra.Command, args []string) {
3839
}
3940

4041
auth.GetSamlCreds(conf)
41-
42+
util.CleanExit()
4243
}

cmd/version.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55

66
"github.com/dnitsch/aws-cli-auth/internal/config"
7+
"github.com/dnitsch/aws-cli-auth/internal/util"
78
"github.com/spf13/cobra"
89
)
910

@@ -22,5 +23,6 @@ var versionCmd = &cobra.Command{
2223
Long: `Version and Revision number of the installed CLI`,
2324
Run: func(cmd *cobra.Command, args []string) {
2425
fmt.Printf("Version: %s\nRevision: %s\n", Version, Revision)
26+
util.CleanExit()
2527
},
2628
}

internal/util/helper.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,8 @@ func GetAllIniSections() ([]string, error) {
158158
}
159159
return sections, nil
160160
}
161+
162+
// CleanExit signals 0 exit code and should clean up any current process
163+
func CleanExit() {
164+
os.Exit(0)
165+
}

0 commit comments

Comments
 (0)