fix(scan): warning if lsof command not found (#1167)

This commit is contained in:
Kota Kanbe
2021-02-07 07:28:45 +09:00
committed by GitHub
parent b4611ae9b7
commit 51b8e169d2
4 changed files with 23 additions and 14 deletions

View File

@@ -1297,7 +1297,8 @@ func (o *debian) dpkgPs() error {
pidListenPorts := map[string][]models.PortStat{}
stdout, err = o.lsOfListen()
if err != nil {
return xerrors.Errorf("Failed to ls of: %w", err)
// warning only, continue scanning
o.log.Warnf("Failed to lsof: %+v", err)
}
portPids := o.parseLsOf(stdout)
for ipPort, pids := range portPids {
@@ -1332,7 +1333,8 @@ func (o *debian) dpkgPs() error {
for _, n := range pkgNames {
p, ok := o.Packages[n]
if !ok {
return xerrors.Errorf("pkg not found %s", n)
o.log.Warnf("Failed to FindByFQPN: %+v", err)
continue
}
p.AffectedProcs = append(p.AffectedProcs, proc)
o.Packages[p.Name] = p