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 // run revid for the specified duration
rv, _, err := startRevid(nil, cfg) rv, _, err := startRevid(nil, cfg)
if err != nil { 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) 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 return
} }
@ -296,7 +299,11 @@ func run(rv *revid.Revid, cfg revid.Config) error {
if vars["mode"] == "Paused" { if vars["mode"] == "Paused" {
if !paused { if !paused {
log.Log(logger.Info, pkg+"pausing revid") 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 paused = true
} }
} else { } else {