Merge pull request #550 from LK4D4/fix_panic
Check for cmd.Process not-nilness in setnsProcess.terminate()
This commit is contained in:
commit
c32142a807
|
@ -119,6 +119,9 @@ func (p *setnsProcess) execSetns() error {
|
||||||
// terminate sends a SIGKILL to the forked process for the setns routine then waits to
|
// terminate sends a SIGKILL to the forked process for the setns routine then waits to
|
||||||
// avoid the process becomming a zombie.
|
// avoid the process becomming a zombie.
|
||||||
func (p *setnsProcess) terminate() error {
|
func (p *setnsProcess) terminate() error {
|
||||||
|
if p.cmd.Process == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
err := p.cmd.Process.Kill()
|
err := p.cmd.Process.Kill()
|
||||||
if _, werr := p.wait(); err == nil {
|
if _, werr := p.wait(); err == nil {
|
||||||
err = werr
|
err = werr
|
||||||
|
|
Loading…
Reference in New Issue