tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

run_with_path.py (792B)


      1 #!/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 
     11 import os
     12 import subprocess
     13 import sys
     14 
     15 SUBST_PATH_ENV_VAR_NAME = "SUBST_PATH"
     16 
     17 def 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 
     31 if __name__ == "__main__":
     32  main()