summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-01-18 13:20:10 -0500
committerGitHub <noreply@github.com>2022-01-18 13:20:10 -0500
commit62212dbf490d736ad06523a92345a480e4972dab (patch)
tree5d9e778f05044018d8cdad7dca9c40a8aa7f2393
parent094665ac0cccc04c7797881ff2a27ff330e9a72e (diff)
parent7e30531f20b8c367aad81454abda8505a0d9962a (diff)
downloadpodman-62212dbf490d736ad06523a92345a480e4972dab.tar.gz
podman-62212dbf490d736ad06523a92345a480e4972dab.tar.bz2
podman-62212dbf490d736ad06523a92345a480e4972dab.zip
Merge pull request #12909 from vrothberg/fix-12904
compat attach: fix write on closed channel
-rw-r--r--libpod/oci_conmon_linux.go6
-rw-r--r--test/apiv2/python/rest_api/test_v2_0_0_container.py2
2 files changed, 4 insertions, 4 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index 3fa43aed9..268a301fb 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -660,13 +660,13 @@ func (r *ConmonOCIRuntime) HTTPAttach(ctr *Container, req *http.Request, w http.
}
errChan <- err
}()
+ if err := ctr.ReadLog(context.Background(), logOpts, logChan); err != nil {
+ return err
+ }
go func() {
logOpts.WaitGroup.Wait()
close(logChan)
}()
- if err := ctr.ReadLog(context.Background(), logOpts, logChan); err != nil {
- return err
- }
logrus.Debugf("Done reading logs for container %s, %d bytes", ctr.ID(), logSize)
if err := <-errChan; err != nil {
return err
diff --git a/test/apiv2/python/rest_api/test_v2_0_0_container.py b/test/apiv2/python/rest_api/test_v2_0_0_container.py
index 1b4597cf8..0386116a8 100644
--- a/test/apiv2/python/rest_api/test_v2_0_0_container.py
+++ b/test/apiv2/python/rest_api/test_v2_0_0_container.py
@@ -130,7 +130,7 @@ class ContainerTestCase(APITestCase):
def test_attach(self):
self.skipTest("FIXME: Test timeouts")
- r = requests.post(self.uri(self.resolve_container("/containers/{}/attach")), timeout=5)
+ r = requests.post(self.uri(self.resolve_container("/containers/{}/attach?logs=true")), timeout=5)
self.assertIn(r.status_code, (101, 500), r.text)
def test_logs(self):