~mterry/snappy/selftest-reboot-notice

« back to all changes in this revision

Viewing changes to cmd/snappy/cmd_remove.go

  • Committer: Snappy Tarmac
  • Author(s): Michael Vogt
  • Date: 2015-06-16 10:32:05 UTC
  • mfrom: (510.1.3 snappy-with-decorator)
  • Revision ID: snappy_tarmac-20150616103205-czpa1fhc2cyr2c9p
Add priv.WithMutex() decorator to avoid duplicating code in cmd/snappy/cmd_*.go by mvo approved by chipaca

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
}
44
44
 
45
45
func (x *cmdRemove) Execute(args []string) (err error) {
46
 
        privMutex := priv.New()
47
 
        if err := privMutex.TryLock(); err != nil {
48
 
                return err
49
 
        }
50
 
        defer privMutex.Unlock()
 
46
        return priv.WithMutex(func() error {
 
47
                return x.doRemove(args)
 
48
        })
 
49
}
51
50
 
 
51
func (x *cmdRemove) doRemove(args []string) error {
52
52
        flags := snappy.DoRemoveGC
53
53
        if x.DisableGC {
54
54
                flags = 0