Dan Blackwell a0e8462770
[compiler-rt][sanitizer_common] Improve handling of env vars for iOS simulator tests (#146721)
* Fix splitting of arguments such as `LSAN_OPTIONS=suppressions=lsan.supp`
* Prevent environment variables set in parent process being overwritten
* Replace hard-coded `env` with `%env` to allow overriding depending on target
* Replace deprecated `pipes` usage with `shlex`
* Run formatter over `iossim_env.py`
2025-07-03 10:25:08 -07:00

18 lines
339 B
Python
Executable File

#!/usr/bin/env python3
import os, sys, subprocess
idx = 1
for arg in sys.argv[1:]:
if not "=" in arg:
break
idx += 1
(argname, argval) = arg.split("=", maxsplit=1)
os.environ["SIMCTL_CHILD_" + argname] = argval
exitcode = subprocess.call(sys.argv[idx:])
if exitcode > 125:
exitcode = 126
sys.exit(exitcode)