summaryrefslogtreecommitdiff
path: root/pkg/hooks/1.0.0/when.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/hooks/1.0.0/when.go')
-rw-r--r--pkg/hooks/1.0.0/when.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/hooks/1.0.0/when.go b/pkg/hooks/1.0.0/when.go
index 3d2a5fd72..c23223ec0 100644
--- a/pkg/hooks/1.0.0/when.go
+++ b/pkg/hooks/1.0.0/when.go
@@ -75,6 +75,9 @@ func (when *When) Match(config *rspec.Spec, annotations map[string]string, hasBi
}
if config.Process != nil {
+ if len(config.Process.Args) == 0 {
+ return false, errors.New("process.args must have at least one entry")
+ }
command := config.Process.Args[0]
for _, cmdPattern := range when.Commands {
match, err := regexp.MatchString(cmdPattern, command)