Added handling for errors so it doesn't just silently exit if the port is in use

This commit is contained in:
Seednode 2022-10-19 20:07:20 -05:00
parent f2204a3019
commit 7819cf3090
2 changed files with 7 additions and 2 deletions

View File

@ -5,6 +5,7 @@ Copyright © 2022 Seednode <seednode@seedno.de>
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)
}
},
}

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
)
var Version = "0.14.1"
var Version = "0.14.2"
func init() {
rootCmd.AddCommand(versionCmd)