Browse code

Fix possible panic on killing container

Signed-off-by: Alexander Morozov <lk4d4@docker.com>

Alexander Morozov authored on 2015/02/19 04:27:38
Showing 1 changed files
... ...
@@ -4,6 +4,7 @@ package native
4 4
 
5 5
 import (
6 6
 	"encoding/json"
7
+	"errors"
7 8
 	"fmt"
8 9
 	"io"
9 10
 	"io/ioutil"
... ...
@@ -173,6 +174,9 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
173 173
 }
174 174
 
175 175
 func (d *driver) Kill(p *execdriver.Command, sig int) error {
176
+	if p.ProcessConfig.Process == nil {
177
+		return errors.New("exec: not started")
178
+	}
176 179
 	return syscall.Kill(p.ProcessConfig.Process.Pid, syscall.Signal(sig))
177 180
 }
178 181