lib,src: fix spawnSync ignoring its 'env' option

PR-URL: https://github.com/joyent/node/pull/8546
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
test: add test for spawnSync() env option

PR-URL: https://github.com/joyent/node/pull/8845
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>