From 9a24ca807b51f39247f780401bd462bdadf8852d Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 27 Jun 2022 19:57:07 +0200 Subject: [PATCH] Fix: Log error when listen is not possible Signed-off-by: Knut Ahlers --- cmd/password/cmdServe.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/password/cmdServe.go b/cmd/password/cmdServe.go index 81753f1..3c62fc9 100644 --- a/cmd/password/cmdServe.go +++ b/cmd/password/cmdServe.go @@ -37,7 +37,9 @@ func actionCmdServe(cmd *cobra.Command, args []string) { r.HandleFunc("/v1/getPassword", handleAPIGetPasswordv1).Methods("GET") http.Handle("/", r) - http.ListenAndServe(fmt.Sprintf(":%d", flags.Server.Port), nil) + if err := http.ListenAndServe(fmt.Sprintf(":%d", flags.Server.Port), nil); err != nil { + log.Fatalf("listening on port :%d: %s", flags.Server.Port, err) + } } func handleAPIGetPasswordv1(res http.ResponseWriter, r *http.Request) {