diff options
author | Abseil Team <absl-team@google.com> | 2019-10-23 18:09:41 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2019-10-23 19:54:45 (GMT) |
commit | 37f322783175a66c11785d17fc153477b0777753 (patch) | |
tree | 150b5f66287ef6a7bd1d381e9de61af5b0dea952 /googletest/scripts/run_with_path.py | |
parent | 1110c471cadf9cf40cb735890d67f135d6313471 (diff) | |
download | googletest-37f322783175a66c11785d17fc153477b0777753.zip googletest-37f322783175a66c11785d17fc153477b0777753.tar.gz googletest-37f322783175a66c11785d17fc153477b0777753.tar.bz2 |
Googletest export
Add a matcher `testing::ReturnRoundRobin` which, on each call, returns the next element in the sequence, restarting at the beginning once it has reached the end.
PiperOrigin-RevId: 276312136
Diffstat (limited to 'googletest/scripts/run_with_path.py')
-rwxr-xr-x | googletest/scripts/run_with_path.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/googletest/scripts/run_with_path.py b/googletest/scripts/run_with_path.py new file mode 100755 index 0000000..d46ab4d --- /dev/null +++ b/googletest/scripts/run_with_path.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# +# Copyright 2010 Google Inc. All Rights Reserved. + +"""Runs program specified in the command line with the substituted PATH. + + This script is needed for to support building under Pulse which is unable + to override the existing PATH variable. +""" + +import os +import subprocess +import sys + +SUBST_PATH_ENV_VAR_NAME = "SUBST_PATH" + +def main(): + if SUBST_PATH_ENV_VAR_NAME in os.environ: + os.environ["PATH"] = os.environ[SUBST_PATH_ENV_VAR_NAME] + + exit_code = subprocess.Popen(sys.argv[1:]).wait() + + # exit_code is negative (-signal) if the process has been terminated by + # a signal. Returning negative exit code is not portable and so we return + # 100 instead. + if exit_code < 0: + exit_code = 100 + + sys.exit(exit_code) + +if __name__ == "__main__": + main() |