Merge pull request #7748 from yanggangtony/containerd-stress

fix panic when containerd-stress density --count 0
This commit is contained in:
Maksym Pavlenko 2022-12-05 10:08:58 -08:00 committed by GitHub
commit 6918432780
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@ import (
"bufio"
"context"
"encoding/json"
"errors"
"fmt"
"os"
"os/signal"
@ -47,6 +48,15 @@ var densityCommand = cli.Command{
},
},
Action: func(cliContext *cli.Context) error {
var (
pids []uint32
count = cliContext.Int("count")
)
if count < 1 {
return errors.New("count cannot be less than one")
}
config := config{
Address: cliContext.GlobalString("address"),
Duration: cliContext.GlobalDuration("duration"),
@ -76,10 +86,6 @@ var densityCommand = cli.Command{
s := make(chan os.Signal, 1)
signal.Notify(s, syscall.SIGTERM, syscall.SIGINT)
var (
pids []uint32
count = cliContext.Int("count")
)
loop:
for i := 0; i < count+1; i++ {
select {