+# helper function: execute a process, return output as iterator, throw exception if there was an error
+# you *must* iterate to the end if you use this!
+def processOutputGen(*args):
+ with subprocess.Popen(args, stdout=subprocess.PIPE) as p:
+ for line in p.stdout:
+ yield line.decode("utf-8")
+ if p.returncode != 0:
+ raise Exception("Error executing "+str(args))
+def processOutputIt(*args):
+ return list(processOutputGen(*args)) # list() iterates over the generator
+