Skip to content

Commit

Permalink
enhance: add hard exit, #78
Browse files Browse the repository at this point in the history
  • Loading branch information
M09Ic committed Nov 1, 2024
1 parent 02162cf commit de12d56
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ func Spray() {
}

ctx, canceler := context.WithTimeout(context.Background(), time.Duration(runner.Deadline)*time.Second)
go func() {
select {
case <-ctx.Done():
time.Sleep(10 * time.Second)
logs.Log.Errorf("deadline and timeout not work, hard exit!!!")
os.Exit(0)
}
}()

go func() {
exitChan := make(chan os.Signal, 2)
signal.Notify(exitChan, os.Interrupt, syscall.SIGTERM)
Expand Down

0 comments on commit de12d56

Please sign in to comment.