revid-cli: capturing errors from calls to stopRevid

This commit is contained in:
saxon 2019-01-13 22:15:30 +10:30
parent 19ae6f1ca6
commit ae792ac11e
1 changed files with 10 additions and 3 deletions

View File

@ -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 {