Skip to content

Commit 61fc773

Browse files
committed
fix(envscan): use errors.Is(e, fs.ErrNotExists) instead of os.IsNotExists
1 parent b42aeb7 commit 61fc773

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

envinspection/inspection.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/murphysecurity/murphysec/infra/logctx"
99
"github.com/murphysecurity/murphysec/model"
1010
"github.com/murphysecurity/murphysec/scanerr"
11-
"os"
11+
"io/fs"
1212
"os/exec"
1313
"reflect"
1414
"runtime"
@@ -64,6 +64,9 @@ func inspectInstalledSoftware(ctx context.Context, module *model.Module) {
6464
pkgs, e := f(ctx)
6565
if e != nil {
6666
LOG.Warnf("Software inspection error(%s): %s, ", fn, e)
67+
if errors.Is(e, fs.ErrNotExist) {
68+
continue
69+
}
6770
var pError *exec.ExitError
6871
if errors.As(e, &pError) {
6972
var stderrText = strings.TrimSpace(string(pError.Stderr))
@@ -76,9 +79,6 @@ func inspectInstalledSoftware(ctx context.Context, module *model.Module) {
7679
})
7780
continue
7881
}
79-
if os.IsNotExist(e) {
80-
continue
81-
}
8282
foundCmd = true
8383
continue
8484
}

0 commit comments

Comments
 (0)