Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions libpod/container_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package libpod

import (
"os"
"time"

"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/libpod/logs"
Expand Down Expand Up @@ -73,27 +72,5 @@ func (c *Container) readFromLogFile(options *logs.LogOptions, logChannel chan *l
}
options.WaitGroup.Done()
}()
// Check if container is still running or paused
go func() {
if options.Follow {
for {
state, err := c.State()
if err != nil && errors.Cause(err) != define.ErrNoSuchCtr {
logrus.Error(err)
break
} else if err != nil {
break
}
if state != define.ContainerStateRunning && state != define.ContainerStatePaused {
err := t.Stop()
if err != nil {
logrus.Error(err)
}
break
}
time.Sleep(1 * time.Second)
}
}
}()
return nil
}
12 changes: 0 additions & 12 deletions test/e2e/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,4 @@ var _ = Describe("Podman logs", func() {
Expect(inspect.ErrorToString()).To(ContainSubstring("no such container"))
}
})

It("follow output stopped container", func() {
containerName := "logs-f"

logc := podmanTest.Podman([]string{"run", "--name", containerName, "-d", ALPINE})
logc.WaitWithDefaultTimeout()
Expect(logc).To(Exit(0))

results := podmanTest.Podman([]string{"logs", "-f", containerName})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
})
})