summaryrefslogtreecommitdiff
path: root/ec2init/execute.py
blob: d7386663a3c8b8b2ad34428ad9de68af48f93ef8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
def run(list,cfg):
    import subprocess
    subprocess.Popen(list).communicate()
    retcode = subprocess.call(list)

    if retcode == 0:
        return

    if retcode < 0:
        str="Cmd terminated by signal %s\n" % -retcode
    else:
        str="Cmd returned %s\n" % retcode
    str+=' '.join(list)
    raise Exception(str)