Now that FD passing is in master, it'd be great to be able to use a received socket (which has already had bind(2) and listen(2) called on it) to fire up a new net.Server instance. This patch adds a net.Server.listenFD() method which will start up the accept watcher on the provided FD.
The fs.readFile bug was hiding another bug that was causing this test to pass, even so it was broken: require.async("../fixtures/throws_error1") in test-module-loading.js This patch fixes the original test by running _compile within a try..catch block for _loadScript. _loadScriptSync also had some useless (deprecated?) code for dealing with module entry point exceptions. This code was also removed for greater clarity.
a) create a layer of indirection in net.Stream to allow swapping in different read/write implementations and b) emit an 'fd' event when file descriptors are received over a UNIX pipe, as finally as a tangential benefit c) remove a bunch of conditionals from the primary codepaths for ease-of-reading.