From 7819cf30905daf7e82a21e90595d955d36b859e6 Mon Sep 17 00:00:00 2001 From: Seednode Date: Wed, 19 Oct 2022 20:07:20 -0500 Subject: [PATCH] Added handling for errors so it doesn't just silently exit if the port is in use --- cmd/root.go | 7 ++++++- cmd/version.go | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 78ea90c..f9d08d4 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,6 +5,7 @@ Copyright © 2022 Seednode package cmd import ( + "fmt" "os" "github.com/spf13/cobra" @@ -19,7 +20,11 @@ var rootCmd = &cobra.Command{ Short: "Serves random images from the specified directories.", Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { - ServePage(args) + err := ServePage(args) + if err != nil { + fmt.Println(err) + os.Exit(1) + } }, } diff --git a/cmd/version.go b/cmd/version.go index 08d3ee0..58dec6c 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -var Version = "0.14.1" +var Version = "0.14.2" func init() { rootCmd.AddCommand(versionCmd)