aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/stdout2stderr.py
blob: a67eb0afb36e196bab61316980efb36c21abb2ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import subprocess
import sys

FILE_PARAM='--file='

if __name__ == '__main__':
    i = 1
    stdout = sys.stderr
    if len(sys.argv) > i and sys.argv[i].startswith(FILE_PARAM):
        file_name = sys.argv[i][len(FILE_PARAM):]
        stdout = open(file_name, "w")
        i += 1
    assert len(sys.argv) > i and not sys.argv[i].startswith(FILE_PARAM)
    sys.exit(subprocess.Popen(sys.argv[i:], stdout=stdout).wait())