From 88f503f27fd0788f8868a02937aed104c80656c4 Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Sun, 23 Feb 2020 21:18:10 +0200 Subject: [PATCH] Print a better error when the daemon isn't running (fix #39) --- cmd/control/cmd/status.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/control/cmd/status.go b/cmd/control/cmd/status.go index 5cfbf1d..e2b9c69 100644 --- a/cmd/control/cmd/status.go +++ b/cmd/control/cmd/status.go @@ -24,7 +24,9 @@ var statusCmd = &cobra.Command{ fmt.Println(" * installed: " + version + " (" + commit + ")") resp, err := getDaemonStatus(config.Port) if err != nil { - fmt.Println(" * daemon: NOT RUNNING!") + fmt.Println(" * RESH-DAEMON IS NOT RUNNING") + exitCode = status.Fail + return } else { fmt.Println(" * daemon: " + resp.Version + " (" + resp.Commit + ")") } @@ -65,7 +67,6 @@ func getDaemonStatus(port int) (msg.StatusResponse, error) { url := "http://localhost:" + strconv.Itoa(port) + "/status" resp, err := http.Get(url) if err != nil { - log.Println("Daemon is not running!", err) return mess, err } defer resp.Body.Close()