Add support for updating the environment from prep_commands.

Reviewed at https://rbcommons.com/s/twitter/r/1222/
Sync of https://github.com/pantsbuild/pants/commit/e0148fcc45156a076cdd22042eddae5b73d7a37d