Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 993

Show
Ignore:
Timestamp:
03/02/06 12:57:25
Author:
fumanchu
Message:

Benchmark: simpler, more inclusive detection of ab/apache not on system path.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/test/benchmark.py

    r992 r993  
    5757def read_process(cmd, args=""): 
    5858    pipein, pipeout = os.popen4("%s %s" % (cmd, args)) 
    59     output = pipeout.read() 
    60     if (# Windows 
    61         output.startswith("'%s' is not recognized" % cmd) 
    62         # bash 
    63         or re.match(r"bash: .*: (No such file|command not found)", output
    64         ): 
    65         raise IOError('%s must be on your system path.' % cmd) 
    66     pipeout.close() 
     59    try: 
     60        firstline = pipeout.readline() 
     61        if (re.search(r"(not recognized|No such file|not found)", firstline, 
     62                      re.IGNORECASE)): 
     63            raise IOError('%s must be on your system path.' % cmd
     64        output = firstline + pipeout.read() 
     65    finally: 
     66        pipeout.close() 
    6767    return output 
    6868 

Hosted by WebFaction

Log in as guest/cpguest to create tickets