Merge pull request #16177 from vrothberg/fix-16142
kill: wait for the container
This commit is contained in:
commit
b712736bd2
|
@ -244,7 +244,12 @@ func (c *Container) Kill(signal uint) error {
|
|||
|
||||
c.newContainerEvent(events.Kill)
|
||||
|
||||
return c.save()
|
||||
// Make sure to wait for the container to exit in case of SIGKILL.
|
||||
if signal == uint(unix.SIGKILL) {
|
||||
return c.waitForConmonToExitAndSave()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Attach attaches to a container.
|
||||
|
|
|
@ -1325,7 +1325,10 @@ func (c *Container) stop(timeout uint) error {
|
|||
|
||||
c.newContainerEvent(events.Stop)
|
||||
c.state.StoppedByUser = true
|
||||
return c.waitForConmonToExitAndSave()
|
||||
}
|
||||
|
||||
func (c *Container) waitForConmonToExitAndSave() error {
|
||||
conmonAlive, err := c.ociRuntime.CheckConmonRunning(c)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -82,6 +82,7 @@ var _ = Describe("Podman attach", func() {
|
|||
Expect(results.OutputToString()).To(ContainSubstring("test"))
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
|
||||
})
|
||||
|
||||
It("podman attach to the latest container", func() {
|
||||
session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", ALPINE, "/bin/sh", "-c", "while true; do echo test1; sleep 1; done"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
|
Loading…
Reference in New Issue