From fecb02ef87ce4499ea2c93d51789d1834c016bea Mon Sep 17 00:00:00 2001 From: nexustar Date: Mon, 21 Nov 2022 10:35:57 +0800 Subject: [PATCH] playground: fix panic (#2076) --- components/playground/playground.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/components/playground/playground.go b/components/playground/playground.go index d14985b7f5..c2bd30afcb 100644 --- a/components/playground/playground.go +++ b/components/playground/playground.go @@ -1012,55 +1012,55 @@ func (p *Playground) terminate(sig syscall.Signal) { timer.Stop() } - if p.monitor != nil { + if p.monitor != nil && p.monitor.cmd != nil && p.monitor.cmd.Process != nil { go kill("prometheus", p.monitor.cmd.Process.Pid, p.monitor.wait) } - if p.ngmonitoring != nil { + if p.ngmonitoring != nil && p.ngmonitoring.cmd != nil && p.ngmonitoring.cmd.Process != nil { go kill("ng-monitoring", p.ngmonitoring.cmd.Process.Pid, p.ngmonitoring.wait) } - if p.grafana != nil { + if p.grafana != nil && p.grafana.cmd != nil && p.grafana.cmd.Process != nil { go kill("grafana", p.grafana.cmd.Process.Pid, p.grafana.wait) } for _, inst := range p.tiflashs { - if inst.Process != nil { + if inst.Process != nil && inst.Process.Cmd() != nil && inst.Process.Cmd().Process != nil { kill(inst.Component(), inst.Pid(), inst.Wait) } } for _, inst := range p.ticdcs { - if inst.Process != nil { + if inst.Process != nil && inst.Process.Cmd() != nil && inst.Process.Cmd().Process != nil { kill(inst.Component(), inst.Pid(), inst.Wait) } } for _, inst := range p.tikvCdcs { - if inst.Process != nil { + if inst.Process != nil && inst.Process.Cmd() != nil && inst.Process.Cmd().Process != nil { kill(inst.Component(), inst.Pid(), inst.Wait) } } for _, inst := range p.drainers { - if inst.Process != nil { + if inst.Process != nil && inst.Process.Cmd() != nil && inst.Process.Cmd().Process != nil { kill(inst.Component(), inst.Pid(), inst.Wait) } } // tidb must exit earlier then pd for _, inst := range p.tidbs { - if inst.Process != nil { + if inst.Process != nil && inst.Process.Cmd() != nil && inst.Process.Cmd().Process != nil { kill(inst.Component(), inst.Pid(), inst.Wait) } } for _, inst := range p.pumps { - if inst.Process != nil { + if inst.Process != nil && inst.Process.Cmd() != nil && inst.Process.Cmd().Process != nil { kill(inst.Component(), inst.Pid(), inst.Wait) } } for _, inst := range p.tikvs { - if inst.Process != nil { + if inst.Process != nil && inst.Process.Cmd() != nil && inst.Process.Cmd().Process != nil { kill(inst.Component(), inst.Pid(), inst.Wait) } } for _, inst := range p.pds { - if inst.Process != nil { + if inst.Process != nil && inst.Process.Cmd() != nil && inst.Process.Cmd().Process != nil { kill(inst.Component(), inst.Pid(), inst.Wait) } }