grype/cmd
devfbe e1bdbc7d27
Fix reading syft json from stdin by redirect (#1299)
I figured out that running `cat syft.json | grype` works but
`grype < syft.json` does not work. This happens, because the
IsPipedInput method only checks if stdin is a pipe which will be false
if stdin is fed by a redirect.

The go idiomatic way to fix this is by just checking if the file
produced by stat has a size > 0.

Implemented this check, that will recognize stdin by redirect, in the
IsPipedInput() method. Renamed the method to IsStdinPipeOrRedirect().

Signed-off-by: Felix Becker <git@felixbecker.name>
Co-authored-by: Benjamin Neff <benjamin@coding4coffee.ch>
2023-05-16 19:41:43 +00:00
..
cmd.go fix: typo in logger prefix (#1283) 2023-05-08 17:03:14 -04:00
completion.go chore: Update grype bootstrap tools to latest versions. (#1187) 2023-03-21 09:36:06 -04:00
db.go add CLI commands / subcommands 2020-05-26 13:31:50 -04:00
db_check.go feat: enrich db check cmd feedback (#853) 2022-08-03 16:34:27 -04:00
db_delete.go Add gosimports linter (#647) 2022-03-03 14:50:24 -05:00
db_diff.go feat: allow grype db diff to specify local db directories (#1058) 2023-01-12 11:26:04 -05:00
db_import.go Add gosimports linter (#647) 2022-03-03 14:50:24 -05:00
db_list.go Add gosimports linter (#647) 2022-03-03 14:50:24 -05:00
db_status.go Add gosimports linter (#647) 2022-03-03 14:50:24 -05:00
db_update.go feat: enrich db check cmd feedback (#853) 2022-08-03 16:34:27 -04:00
event_loop.go Add gosimports linter (#647) 2022-03-03 14:50:24 -05:00
event_loop_test.go Add gosimports linter (#647) 2022-03-03 14:50:24 -05:00
report_writer.go update linter + fix whitespace (#443) 2021-10-06 09:49:42 -04:00
root.go Fix reading syft json from stdin by redirect (#1299) 2023-05-16 19:41:43 +00:00
root_test.go Optionally orient results by CVE (#1020) 2022-12-08 15:22:40 -05:00
signals.go Upgrade config, UI, and command package patterns (#406) 2021-10-01 13:03:50 -04:00
util.go Add db list command (#506) 2021-12-03 16:43:50 +00:00
version.go Add gosimports linter (#647) 2022-03-03 14:50:24 -05:00