diff --git a/cmd/root.go b/cmd/root.go index 82f84d2..5320fc9 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,7 +5,7 @@ Copyright © 2022 Seednode package cmd import ( - "fmt" + "os" "github.com/spf13/cobra" ) @@ -27,8 +27,7 @@ var rootCmd = &cobra.Command{ func Execute() { err := rootCmd.Execute() if err != nil { - fmt.Println(err) - panic(Exit{1}) + os.Exit(1) } } diff --git a/cmd/utils.go b/cmd/utils.go deleted file mode 100644 index 46cad71..0000000 --- a/cmd/utils.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright © 2022 Seednode -*/ - -package cmd - -import ( - "os" -) - -type Exit struct{ Code int } - -func HandleExit() { - if e := recover(); e != nil { - if exit, ok := e.(Exit); ok == true { - os.Exit(exit.Code) - } - panic(e) - } -} diff --git a/cmd/version.go b/cmd/version.go index 027b143..6a2b188 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -var Version = "0.4.0" +var Version = "0.4.1" func init() { rootCmd.AddCommand(versionCmd) diff --git a/cmd/web.go b/cmd/web.go index fb036a6..68f9917 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -123,8 +123,6 @@ func servePageHandler(paths []string) http.HandlerFunc { func doNothing(http.ResponseWriter, *http.Request) {} func ServePage(args []string) { - defer HandleExit() - paths, err := normalizePaths(args) if err != nil { log.Fatal(err)