-from itertools import chain
-from subprocess import CalledProcessError, PIPE, Popen
-from sys import argv, stdout
-from yaml import safe_dump, safe_load
-
-###
-
-def run(cmd):
- """
- Run the given command (a list of program and argument strings) and return the
- stdout as a string, raising a CalledProcessError if the program exited with a
- non-zero status.
- """
- p = Popen(cmd, stdout=PIPE)
- stdout = p.communicate()[0]
- if p.returncode != 0: raise CalledProcessError(p.returncode, cmd)
- return stdout