From 30ce7dbd98607ac830efd63463de7904cbb11c59 Mon Sep 17 00:00:00 2001 From: Johnathan Howell Date: Sat, 27 May 2017 13:03:59 -0400 Subject: [PATCH] clean up listener and exit in fallback --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 234d127..e62ba38 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "log" "net" "net/http" + "os" "github.com/skratchdot/open-golang/open" @@ -103,12 +104,14 @@ func main() { err = open.Run("http://localhost:8087") if err != nil { - // fallback to console. + // fallback to console, clean up the server and exit + l.Close() fmt.Println("Seed:", seedStr) fmt.Println("Addresses:") for _, address := range addresses { fmt.Println(address) } + os.Exit(0) } <-done }