Commits

Robert Brewer  committed 4562c51

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

  • Participants
  • Parent commits 5b39b75

Comments (0)

Files changed (1)

File cherrypy/test/benchmark.py

 
 def read_process(cmd, args=""):
     pipein, pipeout = os.popen4("%s %s" % (cmd, args))
-    output = pipeout.read()
-    if (# Windows
-        output.startswith("'%s' is not recognized" % cmd)
-        # bash
-        or re.match(r"bash: .*: (No such file|command not found)", output)
-        ):
-        raise IOError('%s must be on your system path.' % cmd)
-    pipeout.close()
+    try:
+        firstline = pipeout.readline()
+        if (re.search(r"(not recognized|No such file|not found)", firstline,
+                      re.IGNORECASE)):
+            raise IOError('%s must be on your system path.' % cmd)
+        output = firstline + pipeout.read()
+    finally:
+        pipeout.close()
     return output