Skip to content

Commit

Permalink
🐛 find.files with no results fixed (#2091)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlimus authored Oct 5, 2023
1 parent 133dab5 commit f43f3d1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
36 changes: 18 additions & 18 deletions providers/builtin_dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@

package providers

import (
_ "embed"
// osconf "go.mondoo.com/cnquery/providers/os/config"
// os "go.mondoo.com/cnquery/providers/os/provider"
)
// import (
// _ "embed"

// osconf "go.mondoo.com/cnquery/providers/os/config"
// os "go.mondoo.com/cnquery/providers/os/provider"
// )

// //go:embed os/resources/os.resources.json
// var osInfo []byte

func init() {
// builtinProviders[osconf.Config.ID] = &builtinProvider{
// Runtime: &RunningProvider{
// Name: osconf.Config.Name,
// ID: osconf.Config.ID,
// Plugin: os.Init(),
// Schema: MustLoadSchema("os", osInfo),
// isClosed: false,
// },
// Config: &osconf.Config,
// }

}
// func init() {
// builtinProviders[osconf.Config.ID] = &builtinProvider{
// Runtime: &RunningProvider{
// Name: osconf.Config.Name,
// ID: osconf.Config.ID,
// Plugin: os.Init(),
// Schema: MustLoadSchema("os", osInfo),
// isClosed: false,
// },
// Config: &osconf.Config,
// }
// }
7 changes: 6 additions & 1 deletion providers/os/resources/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@ func (l *mqlFilesFind) list() ([]interface{}, error) {
return nil, out.Error
}

foundFiles = strings.Split(strings.Trim(out.Data, " \t\n"), "\n")
lines := strings.TrimSpace(out.Data)
if lines == "" {
foundFiles = []string{}
} else {
foundFiles = strings.Split(lines, "\n")
}
} else {
return nil, errors.New("find is not supported for your platform")
}
Expand Down

0 comments on commit f43f3d1

Please sign in to comment.