Rebuild environment before launching subprocesses

This ensures that the environment passed to subprocesses always exactly matches the environment visible to script via `$FOO` variables.