From e8349360cce2feb461b202f18ab9b20975c2b956 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Thu, 1 Jun 2023 01:01:08 -0400 Subject: [PATCH] hnctl prints line breaks after errors --- cmd/hnctl/main.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/hnctl/main.go b/cmd/hnctl/main.go index 2268b01..231290b 100644 --- a/cmd/hnctl/main.go +++ b/cmd/hnctl/main.go @@ -60,19 +60,19 @@ func execStart (service string) { pid, err := spawn.PidOf(fullName) if err == nil && spawn.Running(pid) { - cli.Sayf("service is already running") + cli.Sayf("service is already running\n") return } uid, gid, err := spawn.LookupUID(fullName) if err != nil { - cli.Sayf("cannot start service: %v", err) + cli.Sayf("cannot start service: %v\n", err) os.Exit(1) } path, err := exec.LookPath(fullName) if err != nil { - cli.Sayf("cannot start service: %v", err) + cli.Sayf("cannot start service: %v\n", err) os.Exit(1) } @@ -80,7 +80,7 @@ func execStart (service string) { env := append(os.Environ(), "HNAKRA_LOG_DIR=" + logDir) err = ensureLogDir(logDir, int(uid), int(gid)) if err != nil { - cli.Sayf("cannot start service: %v", err) + cli.Sayf("cannot start service: %v\n", err) os.Exit(1) } @@ -88,14 +88,14 @@ func execStart (service string) { // to it err = ensurePidFile(spawn.PidFile(fullName), int(uid), int(gid)) if err != nil { - cli.Sayf("cannot start service: %v", err) + cli.Sayf("cannot start service: %v\n", err) os.Exit(1) } // spawn the service pid, err = spawn.Spawn(path, uid, gid, env) if err != nil { - cli.Sayf("cannot start service: %v", err) + cli.Sayf("cannot start service: %v\n", err) os.Exit(1) } @@ -108,19 +108,19 @@ func execStop (service string) { pid, err := spawn.PidOf(fullName) if err != nil || !spawn.Running(pid) { - cli.Sayf("service is not running") + cli.Sayf("service is not running\n") return } process, err := os.FindProcess(pid) if err != nil { - cli.Sayf("service is not running") + cli.Sayf("service is not running\n") return } err = spawn.KillAndWait(process, 16 * time.Second) if err != nil { - cli.Sayf("could not stop service: %v", err) + cli.Sayf("could not stop service: %v\n", err) os.Exit(1) } }