1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1305,10 +1305,15 @@ func (l *base) parseGrepProcMap(stdout string) (soPaths []string) {
1305
1305
return soPaths
1306
1306
}
1307
1307
1308
+ var errLSOFNoInternetFiles = xerrors .New ("no Internet files located" )
1309
+
1308
1310
func (l * base ) lsOfListen () (string , error ) {
1309
- cmd := `lsof -i -P -n`
1311
+ cmd := `lsof -i -P -n -V `
1310
1312
r := l .exec (util .PrependProxyEnv (cmd ), sudo )
1311
1313
if ! r .isSuccess () {
1314
+ if strings .TrimSpace (r .Stdout ) == "lsof: no Internet files located" {
1315
+ return "" , xerrors .Errorf ("Failed to lsof: %w" , errLSOFNoInternetFiles )
1316
+ }
1312
1317
return "" , xerrors .Errorf ("Failed to lsof: %s" , r )
1313
1318
}
1314
1319
return r .Stdout , nil
@@ -1364,7 +1369,7 @@ func (l *base) pkgPs(getOwnerPkgs func([]string) ([]string, error)) error {
1364
1369
1365
1370
pidListenPorts := map [string ][]models.PortStat {}
1366
1371
stdout , err = l .lsOfListen ()
1367
- if err != nil {
1372
+ if err != nil && ! xerrors . Is ( err , errLSOFNoInternetFiles ) {
1368
1373
// warning only, continue scanning
1369
1374
l .log .Warnf ("Failed to lsof: %+v" , err )
1370
1375
}
0 commit comments