[lxc-devel] [pylxd/master] Fix broken pipe error on xenial integration tests

ajkavanagh on Github lxc-bot at linuxcontainers.org
Thu Apr 23 16:20:13 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 521 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200423/14d6b573/attachment.bin>
-------------- next part --------------
From d6979fdde4356b0edd4d92b5e20052fa32a4ec18 Mon Sep 17 00:00:00 2001
From: Alex Kavanagh <alex.kavanagh at canonical.com>
Date: Thu, 23 Apr 2020 17:16:38 +0100
Subject: [PATCH] Fix broken pipe error on xenial integration tests

It appears that the manager.close_all() can cause a broken pipe
error.  At this stage, that means that the pipe is closed and thus
it's actually okay to just continue and ignore the error (as per stdin)

Fixes: #379
---
 pylxd/models/instance.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pylxd/models/instance.py b/pylxd/models/instance.py
index 12acab90..c45ec431 100644
--- a/pylxd/models/instance.py
+++ b/pylxd/models/instance.py
@@ -438,7 +438,10 @@ def execute(
 
             stdout.finish_soon()
             stderr.finish_soon()
-            manager.close_all()
+            try:
+                manager.close_all()
+            except BrokenPipeError:
+                pass
 
             while not stdout.finished or not stderr.finished:
                 time.sleep(.1)  # progma: no cover


More information about the lxc-devel mailing list