github.com/influxdata/telegraf@v1.30.3/internal/process/process_windows.go (about) 1 //go:build windows 2 3 package process 4 5 import ( 6 "context" 7 "os/exec" 8 "time" 9 ) 10 11 func (p *Process) gracefulStop(ctx context.Context, cmd *exec.Cmd, timeout time.Duration) { 12 select { 13 case <-time.After(timeout): 14 if err := cmd.Process.Kill(); err != nil { 15 p.Log.Errorf("Error after killing process: %v", err) 16 } 17 case <-ctx.Done(): 18 } 19 }