1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Ensure that ticker does not leak

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby 2014-02-27 11:40:25 -08:00
parent fdeea90fc8
commit 44c3b71332

View file

@ -128,8 +128,10 @@ func (d *driver) Restore(c *execdriver.Command) error {
c.Process = &os.Process{
Pid: nspid,
}
ticker := time.NewTicker(500 * time.Millisecond)
defer ticker.Stop()
for _ = range time.Tick(500 * time.Millisecond) {
for _ = range ticker.C {
if err := syscall.Kill(nspid, 0); err != nil {
if strings.Contains(err.Error(), "no such process") {
return nil