Check the error return from listener close

This commit is contained in:
Ted Yu 2019-08-19 09:26:34 -07:00 committed by Ted Yu
parent 9b54021c65
commit 158cf5d61a

View File

@ -208,7 +208,10 @@ func (poc PortOpenCheck) Check() (warnings, errorList []error) {
errorList = []error{errors.Errorf("Port %d is in use", poc.port)}
}
if ln != nil {
ln.Close()
if err = ln.Close(); err != nil {
warnings = append(warnings,
errors.Errorf("when closing port %d, encountered %v", poc.port, err))
}
}
return nil, errorList