aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/xargs.py
blob: 8a6e93e027d76dabeccef44df0eff24d16a00321 (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)