net: do not re-emit stream errors

fix #7015
stream: use `errorEmitted` from `_writableState`
Merge remote-tracking branch 'upstream/v0.10'

Conflicts:
	lib/_stream_writable.js
bindings: add spawn_sync bindings

This implements a nested event loop that makes it possible to control
a child process, while blocking the main loop until the process exits.
child_process: js bits for spawnSync/execSync

This implements the user-facing APIs that lets one run a child process
and block until it exits.

Logic shared with the async counterpart of each function was refactored
to enable code reuse.

Docs and tests are included.