https://github.com/philsquared/Catch
Tip revision: f666f5f0aef121c357a3705b0187e77920a3e0b5 authored by Phil Nash on 12 May 2016, 18:18:04 UTC
v1.5.4
v1.5.4
Tip revision: f666f5f
scriptCommon.py
import os
import sys
import subprocess
catchPath = os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))
def runAndCapture( args ):
child = subprocess.Popen(" ".join( args ), shell=True, stdout=subprocess.PIPE)
lines = []
line = ""
while True:
out = child.stdout.read(1)
if out == '' and child.poll() != None:
break
if out != '':
if out == '\n':
lines.append( line )
line = ""
else:
line = line + out
return lines