If you happen to introduce a circular require into the stack, this
object will be undefined.
Instead, hang on to `require('./run-log.js')`, which is the exports
module which does get filled in later.
The rationale: RunLog is an object that is hardcoded around managing two
other singletons: stdout and stderr. Having multiple RunLogs wouldn't
work well without improving RunLog to have the ability to control other
streams.
We'd like to be able to use RunLog from other places in the tool, most
notably from code called from bundler (while running an app) such as the
npm updater. But threading a RunLog object through that code is
difficult (especially as bundling takes a detour through
release.current.library).
- Exit with failure if proxy starts to listen. Previously, we got stuck
inside ProxyRunner.start(), and since we weren't waiting on any IO
we'd exit 0! (The existence of a yielded fiber is not sufficient to
block Node exit.)
- Don't print various bits of startup text if we are stopped midway.
- Stop main Runner immediately if proxy or mongo runners invoke
onFailure, rather than waiting for wait to be called and return.
- Ensure that a few Futures don't get return called on them multiple
times.
- Ensure we don't try to call close() on the proxy's TCP server if it
failed to listen in the first place.