direct-io.hg

changeset 7456:4d49f61a7fee

Removed xen.util.process, as no-one is using it, and it leaves defunct processes
behind.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Fri Oct 21 11:22:48 2005 +0100 (2005-10-21)
parents 021324804fbd
children cefe36be8592
files
line diff
     1.1 --- a/tools/python/xen/util/process.py	Fri Oct 21 11:21:05 2005 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,39 +0,0 @@
     1.4 -# Copyright (C) 2005 Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
     1.5 -
     1.6 -# os.system() replacement which outputs through the logger
     1.7 -
     1.8 -import popen2
     1.9 -import select
    1.10 -import string
    1.11 -
    1.12 -from xen.xend.XendLogging import log
    1.13 -
    1.14 -def runscript(cmd):
    1.15 -    # split after first space, then grab last component of path
    1.16 -    cmdname = "[%s] " % cmd.split()[0].split('/')[-1]
    1.17 -    # run command and grab stdin, stdout and stderr
    1.18 -    cout, cin, cerr = popen2.popen3(cmd)
    1.19 -    # close stdin to get command to terminate if it waits for input
    1.20 -    cin.close()
    1.21 -    # wait for output and process
    1.22 -    p = select.poll()
    1.23 -    p.register(cout)
    1.24 -    p.register(cerr)
    1.25 -    stdout = ""
    1.26 -    while True:
    1.27 -        r = p.poll()
    1.28 -        for (fd, event) in r:
    1.29 -            if event == select.POLLHUP:
    1.30 -                cout.close()
    1.31 -                cerr.close()
    1.32 -                return stdout
    1.33 -            if fd == cout.fileno():
    1.34 -                stdout = stdout + cout.readline()
    1.35 -            if fd == cerr.fileno():
    1.36 -                l = cerr.readline()
    1.37 -                if l[0] == '-':
    1.38 -                    log.debug(cmdname + l[1:].rstrip())
    1.39 -                elif l[0] == '*':
    1.40 -                    log.info(cmdname + l[1:].rstrip())
    1.41 -                else:
    1.42 -                    log.error(cmdname + l.rstrip())