diff --git a/lib/util/lifecycle.js b/lib/util/lifecycle.js index fc41f506..23887dab 100644 --- a/lib/util/lifecycle.js +++ b/lib/util/lifecycle.js @@ -11,19 +11,21 @@ function Lifecycle() { } Lifecycle.prototype.share = function(name, emitter, options) { - _.defaults(options, { - end: true - , error: true - }) + var opts = _.assign({ + end: true + , error: true + } + , options + ) - if (options.end) { + if (opts.end) { emitter.on('end', function() { log.fatal('%s ended; we shall share its fate', name) this.fatal() }.bind(this)) } - if (options.error) { + if (opts.error) { emitter.on('error', function(err) { log.fatal('%s had an error', name, err.stack) this.fatal()