diff --git a/cmd/control/cmd/status.go b/cmd/control/cmd/status.go index 5cfbf1d..796cdf4 100644 --- a/cmd/control/cmd/status.go +++ b/cmd/control/cmd/status.go @@ -22,12 +22,6 @@ var statusCmd = &cobra.Command{ fmt.Println() fmt.Println("Resh versions ...") fmt.Println(" * installed: " + version + " (" + commit + ")") - resp, err := getDaemonStatus(config.Port) - if err != nil { - fmt.Println(" * daemon: NOT RUNNING!") - } else { - fmt.Println(" * daemon: " + resp.Version + " (" + resp.Commit + ")") - } versionEnv, found := os.LookupEnv("__RESH_VERSION") if found == false { versionEnv = "UNKNOWN!" @@ -37,6 +31,17 @@ var statusCmd = &cobra.Command{ commitEnv = "unknown" } fmt.Println(" * this session: " + versionEnv + " (" + commitEnv + ")") + + resp, err := getDaemonStatus(config.Port) + if err != nil { + fmt.Println(" * RESH-DAEMON IS NOT RUNNING") + fmt.Println(" * Please REPORT this here: https://github.com/curusarn/resh/issues") + fmt.Println(" * Please RESTART this terminal window") + exitCode = status.Fail + return + } + fmt.Println(" * daemon: " + resp.Version + " (" + resp.Commit + ")") + if version != resp.Version || version != versionEnv { fmt.Println(" * THERE IS A MISMATCH BETWEEN VERSIONS!") fmt.Println(" * Please REPORT this here: https://github.com/curusarn/resh/issues") @@ -65,7 +70,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()