ia64/xen-unstable

changeset 19678:ef6911934b6f

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@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri May 29 09:29:58 2009 +0100 (2009-05-29)
parents 50e048b77ad1
children ec2bc4b9fa32
files tools/python/xen/xend/server/BlktapController.py
line diff
     1.1 --- a/tools/python/xen/xend/server/BlktapController.py	Fri May 29 09:28:15 2009 +0100
     1.2 +++ b/tools/python/xen/xend/server/BlktapController.py	Fri May 29 09:29:58 2009 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4  # Copyright (c) 2005, XenSource Ltd.
     1.5  import string, re
     1.6 -import subprocess
     1.7 +import popen2
     1.8  
     1.9  from xen.xend.server.blkif import BlkifController
    1.10  from xen.xend.XendLogging import log
    1.11 @@ -27,9 +27,12 @@ blktap_disk_types = [
    1.12   
    1.13  def doexec(args, inputtext=None):
    1.14      """Execute a subprocess, then return its return code, stdout and stderr"""
    1.15 -    proc = subprocess.Popen(args,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE,close_fds=True)
    1.16 -    (stdout,stderr) = proc.communicate(inputtext)
    1.17 -    rc = proc.returncode
    1.18 +    proc = popen2.Popen3(args, True)
    1.19 +    if inputtext != None:
    1.20 +        proc.tochild.write(inputtext)
    1.21 +    stdout = proc.fromchild
    1.22 +    stderr = proc.childerr
    1.23 +    rc = proc.poll()
    1.24      return (rc,stdout,stderr)
    1.25  
    1.26  def parseDeviceString(device):