I have a driver program which launches and manages hundreds of processes by
p = subprocess.Popen(cmd)
One of the situation I'm facing with is: since many processes may set-up their own environment variable by
os.environ[key] = val
which may disappear after the process exits.
My question is: since some of them may fail, I want to reproduce them locally, so I need the environment variables for the correct if-else path.
Is there a way in python to get env vars from subprocess?