From: Keir Fraser Date: Fri, 29 May 2009 08:29:58 +0000 (+0100) Subject: xend: use popen2 module instead of subprocess for Python 2.3 X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13848 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1e03bc6f026ea388a5dedf64384c198e19ad882f;p=xen.git xend: use popen2 module instead of subprocess for Python 2.3 On Python 2.3, xend cannot started: File "usr/lib/python2.3/site-packages/xen/xend/server/BlktapController.= py", line 3, in ? import subprocess ImportError: No module named subprocess This patch uses `popen2' instead of `subprocess' for Python 2.3. Signed-off-by: KUWAMURA Shin'ya --- diff --git a/tools/python/xen/xend/server/BlktapController.py b/tools/python/xen/xend/server/BlktapController.py index 4c7f334968..682b7e1b1e 100644 --- a/tools/python/xen/xend/server/BlktapController.py +++ b/tools/python/xen/xend/server/BlktapController.py @@ -1,6 +1,6 @@ # Copyright (c) 2005, XenSource Ltd. import string, re -import subprocess +import popen2 from xen.xend.server.blkif import BlkifController from xen.xend.XendLogging import log @@ -27,9 +27,12 @@ blktap_disk_types = [ def doexec(args, inputtext=None): """Execute a subprocess, then return its return code, stdout and stderr""" - proc = subprocess.Popen(args,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE,close_fds=True) - (stdout,stderr) = proc.communicate(inputtext) - rc = proc.returncode + proc = popen2.Popen3(args, True) + if inputtext != None: + proc.tochild.write(inputtext) + stdout = proc.fromchild + stderr = proc.childerr + rc = proc.poll() return (rc,stdout,stderr) def parseDeviceString(device):