blob: d46ab4d34a41a4f1567e73d8b6436b9acb573405 [file] [log] [blame]
James Kuszmaule2f15292021-05-10 22:37:32 -07001#!/usr/bin/env python
2#
3# Copyright 2010 Google Inc. All Rights Reserved.
4
5"""Runs program specified in the command line with the substituted PATH.
6
7 This script is needed for to support building under Pulse which is unable
8 to override the existing PATH variable.
9"""
10
11import os
12import subprocess
13import sys
14
15SUBST_PATH_ENV_VAR_NAME = "SUBST_PATH"
16
17def main():
18 if SUBST_PATH_ENV_VAR_NAME in os.environ:
19 os.environ["PATH"] = os.environ[SUBST_PATH_ENV_VAR_NAME]
20
21 exit_code = subprocess.Popen(sys.argv[1:]).wait()
22
23 # exit_code is negative (-signal) if the process has been terminated by
24 # a signal. Returning negative exit code is not portable and so we return
25 # 100 instead.
26 if exit_code < 0:
27 exit_code = 100
28
29 sys.exit(exit_code)
30
31if __name__ == "__main__":
32 main()