mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-05 20:40:16 -08:00
fix(cli): panic: attempt to get os.Args[1] when len(os.Args) < 2 (#9206)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
This commit is contained in:
@@ -126,7 +126,7 @@ func NewRunner(ctx context.Context, cliOptions flag.Options, opts ...RunnerOptio
|
||||
TraceHTTP: cliOptions.TraceHTTP,
|
||||
}))
|
||||
// get the sub command that is being used or fallback to "trivy"
|
||||
commandName := lo.Ternary(len(os.Args) > 1, os.Args[1], "trivy")
|
||||
commandName := lo.NthOr(os.Args, 1, "trivy")
|
||||
r.versionChecker = notification.NewVersionChecker(commandName, &cliOptions)
|
||||
|
||||
// Update the vulnerability database if needed.
|
||||
|
||||
Reference in New Issue
Block a user