Suppress log message when there is no error

PiperOrigin-RevId: 374981100
This commit is contained in:
Fabricio Voznika
2021-05-20 17:14:19 -07:00
committed by gVisor bot
parent af229f46a1
commit ec542dbedf
+3 -2
View File
@@ -131,8 +131,9 @@ func New(conf *config.Config, args *Args) (*Sandbox, error) {
// The Cleanup object cleans up partially created sandboxes when an error
// occurs. Any errors occurring during cleanup itself are ignored.
c := cleanup.Make(func() {
err := s.destroy()
log.Warningf("error destroying sandbox: %v", err)
if err := s.destroy(); err != nil {
log.Warningf("error destroying sandbox: %v", err)
}
})
defer c.Clean()