[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xend: use popen2 module instead of subprocess for Python 2.3



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1243585798 -3600
# Node ID ef6911934b6f7c85d51417455156466ff0507a56
# Parent  50e048b77ad180e6f32defde3c646b96a5c3626f
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 <kuwa@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/server/BlktapController.py |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff -r 50e048b77ad1 -r ef6911934b6f 
tools/python/xen/xend/server/BlktapController.py
--- a/tools/python/xen/xend/server/BlktapController.py  Fri May 29 09:28:15 
2009 +0100
+++ b/tools/python/xen/xend/server/BlktapController.py  Fri May 29 09:29:58 
2009 +0100
@@ -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):

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.