1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 18:29:17 +02:00

Oops. Fix stupid error in lifecycle.

This commit is contained in:
Simo Kinnunen 2014-04-04 20:16:18 +09:00
parent e0b4b3b40f
commit 941f4cb051

View file

@ -11,19 +11,21 @@ function Lifecycle() {
} }
Lifecycle.prototype.share = function(name, emitter, options) { Lifecycle.prototype.share = function(name, emitter, options) {
_.defaults(options, { var opts = _.assign({
end: true end: true
, error: true , error: true
}) }
, options
)
if (options.end) { if (opts.end) {
emitter.on('end', function() { emitter.on('end', function() {
log.fatal('%s ended; we shall share its fate', name) log.fatal('%s ended; we shall share its fate', name)
this.fatal() this.fatal()
}.bind(this)) }.bind(this))
} }
if (options.error) { if (opts.error) {
emitter.on('error', function(err) { emitter.on('error', function(err) {
log.fatal('%s had an error', name, err.stack) log.fatal('%s had an error', name, err.stack)
this.fatal() this.fatal()