aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/xargs.py
blob: 5d68929eccd34a1f67c29ac2116e7850f9fe25c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import sys
import os
import subprocess

if __name__ == '__main__':
    pos = sys.argv.index('--')
    fname = sys.argv[pos + 1]
    cmd = sys.argv[pos + 2:]

    with open(fname, 'r') as f:
        args = [x.strip() for x in f]

    os.remove(fname)

    p = subprocess.Popen(cmd + args, shell=False, stderr=sys.stderr, stdout=sys.stdout)
    p.communicate()

    sys.exit(p.returncode)