From ae792ac11e6372596174e1f0b3f396696fb0f8cf Mon Sep 17 00:00:00 2001 From: saxon Date: Sun, 13 Jan 2019 22:15:30 +1030 Subject: [PATCH] revid-cli: capturing errors from calls to stopRevid --- cmd/revid-cli/main.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index bc318694..a6096b98 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -75,10 +75,13 @@ func main() { // run revid for the specified duration rv, _, err := startRevid(nil, cfg) if err != nil { - cfg.Logger.Log(logger.Fatal, pkg+"failed to start revid", err.Error()) + cfg.Logger.Log(logger.Fatal, pkg+"failed to start revid", "error", err.Error()) } time.Sleep(*runDurationPtr) - stopRevid(rv) + err = stopRevid(rv) + if err != nil { + cfg.Logger.Log(logger.Error, pkg+"failed to stop revid before program termination", "error", err.Error()) + } return } @@ -296,7 +299,11 @@ func run(rv *revid.Revid, cfg revid.Config) error { if vars["mode"] == "Paused" { if !paused { log.Log(logger.Info, pkg+"pausing revid") - stopRevid(rv) + err = stopRevid(rv) + if err != nil { + log.Log(logger.Error, pkg+"failed to stop revide", "error", err.Error()) + continue + } paused = true } } else {