Change in vdsm[master]: ensure proc terminatation after poll

ybronhei at redhat.com ybronhei at redhat.com
Mon Jan 25 01:08:34 UTC 2016


Yaniv Bronhaim has uploaded a new change for review.

Change subject: ensure proc terminatation after poll
......................................................................

ensure proc terminatation after poll

Change-Id: I9bbd07bf33109315f4ea6b9fc2d629163f6696da
Signed-off-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M lib/vdsm/commands.py
1 file changed, 10 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/52670/1

diff --git a/lib/vdsm/commands.py b/lib/vdsm/commands.py
index 59e8a1a..33b265e 100644
--- a/lib/vdsm/commands.py
+++ b/lib/vdsm/commands.py
@@ -83,19 +83,20 @@
                     six.reraise(*exc_info)
         return p
 
-    (out, err) = p.communicate(data)
+    with terminating(p):
+        (out, err) = p.communicate(data)
 
-    if out is None:
-        # Prevent splitlines() from barfing later on
-        out = ""
+        if out is None:
+            # Prevent splitlines() from barfing later on
+            out = ""
 
-    execCmdLogger.debug(cmdutils.retcode_log_line(p.returncode, err=err))
+        execCmdLogger.debug(cmdutils.retcode_log_line(p.returncode, err=err))
 
-    if not raw:
-        out = out.splitlines(False)
-        err = err.splitlines(False)
+        if not raw:
+            out = out.splitlines(False)
+            err = err.splitlines(False)
 
-    return p.returncode, out, err
+        return p.returncode, out, err
 
 
 class AsyncProc(object):


-- 
To view, visit https://gerrit.ovirt.org/52670
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9bbd07bf33109315f4ea6b9fc2d629163f6696da
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>


More information about the vdsm-patches mailing list