Add a way to retrieve a test container event channel
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
parent
e6b2ed4b7f
commit
3481996e9d
1 changed files with 9 additions and 0 deletions
|
@ -110,12 +110,21 @@ func (c *containerProcess) openIo() (err error) {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (c *containerProcess) GetEventsChannel() chan *types.Event {
|
||||
return c.eventsCh
|
||||
}
|
||||
|
||||
func (c *containerProcess) GetNextEvent() *types.Event {
|
||||
if c.hasExited {
|
||||
return nil
|
||||
}
|
||||
|
||||
e := <-c.eventsCh
|
||||
|
||||
if e.Type == "exit" && e.Pid == c.pid {
|
||||
c.Cleanup()
|
||||
c.hasExited = true
|
||||
close(c.eventsCh)
|
||||
}
|
||||
|
||||
return e
|
||||
|
|
Loading…
Reference in a new issue