• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import os
2import sys
3import subprocess
4
5
6catchPath = os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))
7
8def getBuildExecutable():
9    if os.name == 'nt':
10        dir = os.environ.get('CATCH_DEV_OUT_DIR', "cmake-build-debug/projects/SelfTest.exe")
11        return dir
12    else:
13        dir = os.environ.get('CATCH_DEV_OUT_DIR', "cmake-build-debug/projects/SelfTest")
14        return dir
15
16
17def runAndCapture( args ):
18    child = subprocess.Popen(" ".join( args ), shell=True, stdout=subprocess.PIPE)
19    lines = []
20    line = ""
21    while True:
22        out = child.stdout.read(1)
23        if out == '' and child.poll():
24            break
25        if out != '':
26            if out == '\n':
27                lines.append( line )
28                line = ""
29            else:
30                line = line + out
31    return lines
32