revid-cli: dealing with errors in revid-cli from start and stop if they occur

This commit is contained in:
saxon 2019-01-13 22:04:50 +10:30
parent 5ae1e41e38
commit 19ae6f1ca6
1 changed files with 12 additions and 5 deletions

View File

@ -343,21 +343,28 @@ func startRevid(ns *netsender.Sender, cfg revid.Config) (*revid.Revid, revid.Con
if err != nil { if err != nil {
return nil, cfg, err return nil, cfg, err
} }
rv.Start() err = rv.Start()
return rv, cfg, nil return rv, cfg, err
} }
func stopRevid(rv *revid.Revid) { func stopRevid(rv *revid.Revid) error {
rv.Stop() err := rv.Stop()
if err != nil {
return err
}
// FIXME(kortschak): Is this waiting on completion of work? // FIXME(kortschak): Is this waiting on completion of work?
// Use a wait group and Wait method if it is. // Use a wait group and Wait method if it is.
time.Sleep(revidStopTime) time.Sleep(revidStopTime)
return nil
} }
func updateRevid(ns *netsender.Sender, rv *revid.Revid, cfg revid.Config, vars map[string]string, stop bool) (*revid.Revid, revid.Config, error) { func updateRevid(ns *netsender.Sender, rv *revid.Revid, cfg revid.Config, vars map[string]string, stop bool) (*revid.Revid, revid.Config, error) {
if stop { if stop {
stopRevid(rv) err := stopRevid(rv)
if err != nil {
return nil, cfg, err
}
} }
//look through the vars and update revid where needed //look through the vars and update revid where needed